Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114801
b: refs/heads/master
c: c0f54d3
h: refs/heads/master
i:
  114799: e1dd58e
v: v3
  • Loading branch information
Ian Kent authored and Linus Torvalds committed Oct 16, 2008
1 parent a4849c3 commit bf02bdc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb979d7fc360bc37cbaff43a6fafceb897cb5e47
refs/heads/master: c0f54d3e54fd7ac6723b2125d881f1b25d21ed16
3 changes: 3 additions & 0 deletions trunk/fs/autofs4/autofs_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ struct autofs_info {
unsigned long last_used;
atomic_t count;

uid_t uid;
gid_t gid;

mode_t mode;
size_t size;

Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/autofs4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
atomic_set(&ino->count, 0);
}

ino->uid = 0;
ino->gid = 0;
ino->mode = mode;
ino->last_used = jiffies;

Expand Down
34 changes: 34 additions & 0 deletions trunk/fs/autofs4/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,40 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,

status = wq->status;

/*
* For direct and offset mounts we need to track the requester's
* 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 autofs_info *ino;
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);
if (de)
ino = autofs4_dentry_ino(de);
}

/* Set mount requester */
if (ino) {
spin_lock(&sbi->fs_lock);
ino->uid = wq->uid;
ino->gid = wq->gid;
spin_unlock(&sbi->fs_lock);
}

if (de)
dput(de);
}

/* Are we the last process to need status? */
mutex_lock(&sbi->wq_mutex);
if (!--wq->wait_ctr)
Expand Down

0 comments on commit bf02bdc

Please sign in to comment.