[lkml]   [2000]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch-2.4.0-test10-pre3] fix for notify_change()
Hi Linus,

In an ideal work (free of bugs) notify_change() can never receive a
negative dentry because it would subsequently oops in
inode_change_ok() when dereferencing inode->i_uid. Therefore:

a) instead of oopsing in inode_change_ok() and having to trace the reason
back to notify_change() it is better to trap it as early as possible
inside notify_change() as a BUG()

b) when compiling for "ideal world" with empty BUG() the compiler would
produce a faster code.

Thus the patch, tested under 2.4.0-test10-pre3.


--- linux/fs/attr.c Fri Sep 22 22:21:18 2000
+++ work/fs/attr.c Sun Oct 15 21:49:37 2000
@@ -110,6 +110,9 @@
time_t now = CURRENT_TIME;
unsigned int ia_valid = attr->ia_valid;

+ if (!inode)
+ BUG();
attr->ia_ctime = now;
if (!(ia_valid & ATTR_ATIME_SET))
attr->ia_atime = now;
@@ -117,7 +120,7 @@
attr->ia_mtime = now;

- if (inode && inode->i_op && inode->i_op->setattr)
+ if (inode->i_op && inode->i_op->setattr)
error = inode->i_op->setattr(dentry, attr);
else {
error = inode_change_ok(inode, attr);
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:45    [W:1.901 / U:0.588 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site