Skip to content

Commit

Permalink
NFS: Don't silently fail setattr() requests on mountpoints
Browse files Browse the repository at this point in the history
Ensure that any setattr and getattr requests for junctions and/or
mountpoints are sent to the server. Ever since commit
0ec26fd (vfs: automount should ignore LOOKUP_FOLLOW), we have
silently dropped any setattr requests to a server-side mountpoint.
For referrals, we have silently dropped both getattr and setattr
requests.

This patch restores the original behaviour for setattr on mountpoints,
and tries to do the same for referrals, provided that we have a
filehandle...

Signed-off-by: Trond Myklebust <[email protected]>
Cc: [email protected]
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jan 30, 2013
1 parent 65436ec commit ab22541
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fs/nfs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,31 @@ struct vfsmount *nfs_d_automount(struct path *path)
return mnt;
}

static int
nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
if (NFS_FH(dentry->d_inode)->size != 0)
return nfs_getattr(mnt, dentry, stat);
generic_fillattr(dentry->d_inode, stat);
return 0;
}

static int
nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr)
{
if (NFS_FH(dentry->d_inode)->size != 0)
return nfs_setattr(dentry, attr);
return -EACCES;
}

const struct inode_operations nfs_mountpoint_inode_operations = {
.getattr = nfs_getattr,
.setattr = nfs_setattr,
};

const struct inode_operations nfs_referral_inode_operations = {
.getattr = nfs_namespace_getattr,
.setattr = nfs_namespace_setattr,
};

static void nfs_expire_automounts(struct work_struct *work)
Expand Down

0 comments on commit ab22541

Please sign in to comment.