patch-2.1.78 linux/fs/open.c

Next file: linux/fs/proc/generic.c
Previous file: linux/fs/nls/nls_cp861.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.77/linux/fs/open.c linux/fs/open.c
@@ -69,15 +69,16 @@
 	return error;
 }
 
-int do_truncate(struct inode *inode, unsigned long length)
+int do_truncate(struct dentry *dentry, unsigned long length)
 {
+	struct inode *inode = dentry->d_inode;
 	int error;
 	struct iattr newattrs;
 
 	down(&inode->i_sem);
 	newattrs.ia_size = length;
 	newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-	error = notify_change(inode, &newattrs);
+	error = notify_change(dentry, &newattrs);
 	if (!error) {
 		/* truncate virtual mappings of this file */
 		vmtruncate(inode, length);
@@ -128,7 +129,7 @@
 	if (!error) {
 		if (inode->i_sb && inode->i_sb->dq_op)
 			inode->i_sb->dq_op->initialize(inode, -1);
-		error = do_truncate(inode, length);
+		error = do_truncate(dentry, length);
 	}
 	put_write_access(inode);
 dput_and_out:
@@ -161,7 +162,7 @@
 					  length<inode->i_size ? length : inode->i_size,
 					  abs(inode->i_size - length));
 		if (!error)
-			error = do_truncate(inode, length);
+			error = do_truncate(dentry, length);
 	}
 	unlock_kernel();
 	return error;
@@ -214,7 +215,7 @@
 		    (error = permission(inode,MAY_WRITE)) != 0)
 			goto dput_and_out;
 	}
-	error = notify_change(inode, &newattrs);
+	error = notify_change(dentry, &newattrs);
 dput_and_out:
 	dput(dentry);
 out:
@@ -261,7 +262,7 @@
 		if ((error = permission(inode,MAY_WRITE)) != 0)
 			goto dput_and_out;
 	}
-	error = notify_change(inode, &newattrs);
+	error = notify_change(dentry, &newattrs);
 dput_and_out:
 	dput(dentry);
 out:
@@ -441,7 +442,7 @@
 		mode = inode->i_mode;
 	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
 	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-	err = notify_change(inode, &newattrs);
+	err = notify_change(dentry, &newattrs);
 out:
 	unlock_kernel();
 	return err;
@@ -474,7 +475,7 @@
 		mode = inode->i_mode;
 	newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
 	newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
-	error = notify_change(inode, &newattrs);
+	error = notify_change(dentry, &newattrs);
 
 dput_and_out:
 	dput(dentry);
@@ -530,11 +531,11 @@
 		error = -EDQUOT;
 		if (inode->i_sb->dq_op->transfer(inode, &newattrs, 0))
 			goto out;
-		error = notify_change(inode, &newattrs);
+		error = notify_change(dentry, &newattrs);
 		if (error)
 			inode->i_sb->dq_op->transfer(inode, &newattrs, 1);
 	} else
-		error = notify_change(inode, &newattrs);
+		error = notify_change(dentry, &newattrs);
 out:
 	return error;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov