diff options
Diffstat (limited to 'fs/hpfs/inode.c')
-rw-r--r-- | fs/hpfs/inode.c | 29 |
1 files changed, 19 insertions, 10 deletions
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 | } |