From: Inguva <inguva@softhome.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH]:2.4.19: do_revalidate in chown
Date: Thu, 05 Sep 2002 18:32:20 -0700 [thread overview]
Message-ID: <3D7805A4.1BF0E967@softhome.net> (raw)
Greetings,
Requesting for comments on the below findings and the patch.
sys_stat() does a do_revalidate() after user_path_walk() but sys_chown()
does not. This causes sys_chown() to use incorrect attribute information
on distributed file systems. The sys_stat does do_revalidate() to
revalidate the inodes for proper NFS attibute caching.
But when sys_chown calls chown_common after the user_path_walk, no
checks are being done regarding the dentry values, which contain cached
inode values. On Distributed File system environments there may be a
likelyhood that these values may not be current and there is a
likelihood of stale values being read.
Hence doing a do_revalidate before the chown calls will help address
this issue.
Below is a patch which does that.
Regards,
Inguva
diff -urN ./fs/open.c ./fs-fixed/open.c
--- ./fs/open.c Thu Sep 5 02:34:38 2002
+++ ./fs-fixed/open.c Thu Sep 5 14:44:24 2002
@@ -20,6 +20,8 @@
#define special_file(m)
(S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
+extern int do_revalidate(struct dentry *);
+
int vfs_statfs(struct super_block *sb, struct statfs *buf)
{
int retval = -ENODEV;
@@ -608,7 +610,9 @@
error = user_path_walk(filename, &nd);
if (!error) {
- error = chown_common(nd.dentry, user, group);
+ error = do_revalidate(nd.dentry);
+ if (!error)
+ error = chown_common(nd.dentry, user, group);
path_release(&nd);
}
return error;
@@ -621,7 +625,9 @@
error = user_path_walk_link(filename, &nd);
if (!error) {
- error = chown_common(nd.dentry, user, group);
+ error = do_revalidate(nd.dentry);
+ if (!error)
+ error = chown_common(nd.dentry, user, group);
path_release(&nd);
}
return error;
@@ -632,12 +638,15 @@
{
struct file * file;
int error = -EBADF;
-
- file = fget(fd);
- if (file) {
- error = chown_common(file->f_dentry, user, group);
- fput(file);
- }
+
+ if(!do_revalidate(file->f_dentry))
+ {
+ file = fget(fd);
+ if (file) {
+ error = chown_common(file->f_dentry, user, group);
+ fput(file);
+ }
+ }
return error;
}
diff -urN ./fs/stat.c ./fs-fixed/stat.c
--- ./fs/stat.c Thu Sep 5 09:59:52 2002
+++ ./fs-fixed/stat.c Thu Sep 5 14:44:24 2002
@@ -13,11 +13,12 @@
#include <asm/uaccess.h>
+extern int do_revalidate(struct dentry *);
+
/*
* Revalidate the inode. This is required for proper NFS attribute
caching.
*/
-static __inline__ int
-do_revalidate(struct dentry *dentry)
+int do_revalidate(struct dentry *dentry)
{
struct inode * inode = dentry->d_inode;
if (inode->i_op && inode->i_op->revalidate)
reply other threads:[~2002-09-05 12:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D7805A4.1BF0E967@softhome.net \
--to=inguva@softhome.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.