patch-2.4.10 linux/fs/attr.c

Next file: linux/fs/autofs/root.c
Previous file: linux/fs/affs/super.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/fs/attr.c linux/fs/attr.c
@@ -57,16 +57,21 @@
 	return retval;
 }
 
-void inode_setattr(struct inode * inode, struct iattr * attr)
+int inode_setattr(struct inode * inode, struct iattr * attr)
 {
 	unsigned int ia_valid = attr->ia_valid;
+	int error = 0;
+
+	if (ia_valid & ATTR_SIZE) {
+		error = vmtruncate(inode, attr->ia_size);
+		if (error)
+			goto out;
+	}
 
 	if (ia_valid & ATTR_UID)
 		inode->i_uid = attr->ia_uid;
 	if (ia_valid & ATTR_GID)
 		inode->i_gid = attr->ia_gid;
-	if (ia_valid & ATTR_SIZE)
-		vmtruncate(inode, attr->ia_size);
 	if (ia_valid & ATTR_ATIME)
 		inode->i_atime = attr->ia_atime;
 	if (ia_valid & ATTR_MTIME)
@@ -79,6 +84,8 @@
 			inode->i_mode &= ~S_ISGID;
 	}
 	mark_inode_dirty(inode);
+out:
+	return error;
 }
 
 static int setattr_mask(unsigned int ia_valid)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)