diff options
-rw-r--r-- | fs/hpfs/file.c | 2 | ||||
-rw-r--r-- | fs/hpfs/hpfs_fn.h | 2 | ||||
-rw-r--r-- | fs/hpfs/inode.c | 29 | ||||
-rw-r--r-- | fs/hpfs/namei.c | 2 |
4 files changed, 22 insertions, 13 deletions
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index be8be5040e07..64ab52259204 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -143,5 +143,5 @@ const struct file_operations hpfs_file_ops = | |||
143 | const struct inode_operations hpfs_file_iops = | 143 | const struct inode_operations hpfs_file_iops = |
144 | { | 144 | { |
145 | .truncate = hpfs_truncate, | 145 | .truncate = hpfs_truncate, |
146 | .setattr = hpfs_notify_change, | 146 | .setattr = hpfs_setattr, |
147 | }; | 147 | }; |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index 42ff60ccf2a9..c2ea31bae313 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -275,7 +275,7 @@ void hpfs_init_inode(struct inode *); | |||
275 | void hpfs_read_inode(struct inode *); | 275 | void hpfs_read_inode(struct inode *); |
276 | void hpfs_write_inode(struct inode *); | 276 | void hpfs_write_inode(struct inode *); |
277 | void hpfs_write_inode_nolock(struct inode *); | 277 | void hpfs_write_inode_nolock(struct inode *); |
278 | int hpfs_notify_change(struct dentry *, struct iattr *); | 278 | int hpfs_setattr(struct dentry *, struct iattr *); |
279 | void hpfs_write_if_changed(struct inode *); | 279 | void hpfs_write_if_changed(struct inode *); |
280 | void hpfs_delete_inode(struct inode *); | 280 | void hpfs_delete_inode(struct inode *); |
281 | 281 | ||
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 85d3e1d9ac00..39a1bfbea312 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -260,19 +260,28 @@ void hpfs_write_inode_nolock(struct inode *i) | |||
260 | brelse(bh); | 260 | brelse(bh); |
261 | } | 261 | } |
262 | 262 | ||
263 | int hpfs_notify_change(struct dentry *dentry, struct iattr *attr) | 263 | int hpfs_setattr(struct dentry *dentry, struct iattr *attr) |
264 | { | 264 | { |
265 | struct inode *inode = dentry->d_inode; | 265 | struct inode *inode = dentry->d_inode; |
266 | int error=0; | 266 | int error = -EINVAL; |
267 | |||
267 | lock_kernel(); | 268 | lock_kernel(); |
268 | if ( ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) || | 269 | if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) |
269 | (hpfs_sb(inode->i_sb)->sb_root == inode->i_ino) ) { | 270 | goto out_unlock; |
270 | error = -EINVAL; | 271 | if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) |
271 | } else if ((error = inode_change_ok(inode, attr))) { | 272 | goto out_unlock; |
272 | } else if ((error = inode_setattr(inode, attr))) { | 273 | |
273 | } else { | 274 | error = inode_change_ok(inode, attr); |
274 | hpfs_write_inode(inode); | 275 | if (error) |
275 | } | 276 | goto out_unlock; |
277 | |||
278 | error = inode_setattr(inode, attr); | ||
279 | if (error) | ||
280 | goto out_unlock; | ||
281 | |||
282 | hpfs_write_inode(inode); | ||
283 | |||
284 | out_unlock: | ||
276 | unlock_kernel(); | 285 | unlock_kernel(); |
277 | return error; | 286 | return error; |
278 | } | 287 | } |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index d9c59a775449..10783f3d265a 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -669,5 +669,5 @@ const struct inode_operations hpfs_dir_iops = | |||
669 | .rmdir = hpfs_rmdir, | 669 | .rmdir = hpfs_rmdir, |
670 | .mknod = hpfs_mknod, | 670 | .mknod = hpfs_mknod, |
671 | .rename = hpfs_rename, | 671 | .rename = hpfs_rename, |
672 | .setattr = hpfs_notify_change, | 672 | .setattr = hpfs_setattr, |
673 | }; | 673 | }; |