Hi Andrew,
Patch to track the uid and gid of the last process to request
a mount for on an autofs dentry.
Signed-off-by: Ian Kent < raven@themaw.net>
Ian
---
diff -up linux-2.6.25-rc2-mm1/fs/autofs4/inode.c.track-last-mount-ids linux-2.6.25-rc2-mm1/fs/autofs4/inode.c
--- linux-2.6.25-rc2-mm1/fs/autofs4/inode.c.track-last-mount-ids 2008-02-20 13:11:28.000000000 +0900
+++ linux-2.6.25-rc2-mm1/fs/autofs4/inode.c 2008-02-20 13:12:23.000000000 +0900
@@ -43,6 +43,8 @@ struct autofs_info *autofs4_init_ino(str
ino->flags = 0;
ino->mode = mode;
+ ino->uid = 0;
+ ino->gid = 0;
ino->inode = NULL;
ino->dentry = NULL;
ino->size = 0;
diff -up linux-2.6.25-rc2-mm1/fs/autofs4/autofs_i.h.track-last-mount-ids linux-2.6.25-rc2-mm1/fs/autofs4/autofs_i.h
--- linux-2.6.25-rc2-mm1/fs/autofs4/autofs_i.h.track-last-mount-ids 2008-02-20 13:14:03.000000000 +0900
+++ linux-2.6.25-rc2-mm1/fs/autofs4/autofs_i.h 2008-02-20 13:14:34.000000000 +0900
@@ -58,6 +58,9 @@ struct autofs_info {
unsigned long last_used;
atomic_t count;
+ uid_t uid;
+ gid_t gid;
+
mode_t mode;
size_t size;
diff -up linux-2.6.25-rc2-mm1/fs/autofs4/waitq.c.track-last-mount-ids linux-2.6.25-rc2-mm1/fs/autofs4/waitq.c
--- linux-2.6.25-rc2-mm1/fs/autofs4/waitq.c.track-last-mount-ids 2008-02-20 13:06:20.000000000 +0900
+++ linux-2.6.25-rc2-mm1/fs/autofs4/waitq.c 2008-02-20 13:10:23.000000000 +0900
@@ -363,6 +363,38 @@ int autofs4_wait(struct autofs_sb_info *
status = wq->status;
+ /*
+ * For direct and offset mounts we need to track the requestor
+ * uid and gid in the dentry info struct. This is so it can be
+ * supplied, on request, by the misc device ioctl interface.
+ * This is needed during daemon resatart when reconnecting
+ * to existing, active, autofs mounts. The uid and gid (and
+ * related string values) may be used for macro substitution
+ * in autofs mount maps.
+ */
+ if (!status) {
+ struct dentry *de = NULL;
+
+ /* direct mount or browsable map */
+ ino = autofs4_dentry_ino(dentry);
+ if (!ino) {
+ /* If not lookup actual dentry used */
+ de = d_lookup(dentry->d_parent, &dentry->d_name);
+ ino = autofs4_dentry_ino(de);
+ }
+
+ /* Set mount requestor */
+ if (ino) {
+ if (ino) {
+ ino->uid = wq->uid;
+ ino->gid = wq->gid;
+ }
+ }
+
+ if (de)
+ dput(de);
+ }
+
/* Are we the last process to need status? */
if (atomic_dec_and_test(&wq->wait_ctr))
kfree(wq);
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Peter Zijlstra | [PATCH 00/23] per device dirty throttling -v8 |
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Andrew Morton | Re: Ext3 vs NTFS performance |
git: | |
| Johannes Sixt | [PATCH 03/40] Add target architecture MinGW. |
| Sergei Organov | Newbie: report of first experience with git-rebase. |
| Scott Chacon | Git Community Book |
| Sebastian Schuberth | git on Cygwin: Not a valid object name HEAD |
| Richard Stallman | Real men don't attack straw men |
| Marius ROMAN | 1440x900 resolution problem |
| Leon Dippenaar | New tcp stack attack |
| Alexey Suslikov | OT: OpenBSD on Asus eeePC |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Linus Torvalds | Re: [crash] kernel BUG at net/core/dev.c:1328! |
| Frithjof Hammer | Re: [LARTC] ifb and ppp |
