summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lever <cel@citi.umich.edu>2002-11-07 00:43:31 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-11-07 00:43:31 -0800
commit2fbace6096db970a2e5c1e5a25570135394f494c (patch)
tree08f82e8a0f17ad91049d05bde437854126e46017
parent20eb6a8b29f845a0a1dd893a91cac35ac3cc3b45 (diff)
[PATCH] too many setattr calls from VFS layer
New code in 2.5 VFS layer invokes notify_change to clear the suid and sgid bits for every write request. notify_change needs to optimize out calls to ->setattr that don't do anything, because for many network file systems, an on-the-wire SETATTR request is generated for every ->setattr call, resulting in unnecessary latency for NFS writes.
-rw-r--r--fs/attr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/attr.c b/fs/attr.c
index 1b44201b410b..b262574207e1 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -134,6 +134,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
if (!(ia_valid & ATTR_MTIME_SET))
attr->ia_mtime = now;
if (ia_valid & ATTR_KILL_SUID) {
+ attr->ia_valid &= ~ATTR_KILL_SUID;
if (mode & S_ISUID) {
if (!(ia_valid & ATTR_MODE)) {
ia_valid = attr->ia_valid |= ATTR_MODE;
@@ -143,6 +144,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
}
}
if (ia_valid & ATTR_KILL_SGID) {
+ attr->ia_valid &= ~ ATTR_KILL_SGID;
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
if (!(ia_valid & ATTR_MODE)) {
ia_valid = attr->ia_valid |= ATTR_MODE;
@@ -151,6 +153,8 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
attr->ia_mode &= ~S_ISGID;
}
}
+ if (!attr->ia_valid)
+ return 0;
if (inode->i_op && inode->i_op->setattr) {
error = security_ops->inode_setattr(dentry, attr);