lkml.org 
[lkml]   [2007]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/4] Fix networked filesystems to handle ATTR_KILL_ bits correctly
This fixes NFS and CIFS to take advantage of the new scheme for
handling setuid/setgid bits. For these filesystems we want to just
let the server handle clearing these bits since the client may not
have permissions to do so.

For CIFS, this adds a patch to clear the ATTR_KILL bits so that
notify_change doesn't try to do a second setattr. NFS already clears
these bits, and this just updates a comment to make it clear
that doing this is more than an optimization.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/cifs/inode.c | 5 +++++
fs/nfs/inode.c | 6 +++++-
2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index dd41677..9668b45 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1429,6 +1429,11 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
pTcon = cifs_sb->tcon;

+ /* We may not have permissions to clear the setuid/setgid flags. So
+ * ignore them and let the server handle it.
+ */
+ attrs->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
+
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
/* check if we have permission to change attrs */
rc = inode_change_ok(direntry->d_inode, attrs);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 93fc788..b257f18 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -332,7 +332,11 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
attr->ia_valid &= ~ATTR_SIZE;
}

- /* Optimization: if the end result is no change, don't RPC */
+ /*
+ * Optimization: if the end result is no change, don't RPC. This
+ * also clears the ATTR_KILL_* flags, which is now needed by
+ * notify_change.
+ */
attr->ia_valid &= NFS_VALID_ATTRS;
if (attr->ia_valid == 0)
return 0;
--
1.5.2.2
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-20 23:01    [W:0.024 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site