summaryrefslogtreecommitdiff
path: root/fs/ufs/truncate.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ufs/truncate.c')
-rw-r--r--fs/ufs/truncate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 21154704c168..90cf3a76c500 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -457,6 +457,7 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
return -EPERM;
+ lock_ufs(sb);
err = ufs_alloc_lastblock(inode);
if (err) {
@@ -486,6 +487,7 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
ufsi->i_lastfrag = DIRECT_FRAGMENT;
mark_inode_dirty(inode);
out:
+ unlock_ufs(sb);
UFSD("EXIT: err %d\n", err);
return err;
}
@@ -506,9 +508,7 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr)
/* XXX(truncate): truncate_setsize should be called last */
truncate_setsize(inode, attr->ia_size);
- lock_ufs(inode->i_sb);
error = ufs_truncate(inode, old_i_size);
- unlock_ufs(inode->i_sb);
if (error)
return error;
}