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.
Regards,
Tigran
--- 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;
lock_kernel();
- 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 majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:29 EST