Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63360
b: refs/heads/master
c: 9700382
h: refs/heads/master
v: v3
  • Loading branch information
david m. richter authored and Linus Torvalds committed Jul 31, 2007
1 parent b7f718a commit 55af982
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 937472b00b666ecbf1464502f857ec63b024af72
refs/heads/master: 9700382c3c9ff3e673e587084d76eedb3ba88668
16 changes: 9 additions & 7 deletions trunk/fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,24 +256,26 @@ static long do_sys_truncate(const char __user * path, loff_t length)
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto dput_and_out;

/*
* Make sure that there are no leases.
*/
error = break_lease(inode, FMODE_WRITE);
error = get_write_access(inode);
if (error)
goto dput_and_out;

error = get_write_access(inode);
/*
* Make sure that there are no leases. get_write_access() protects
* against the truncate racing with a lease-granting setlease().
*/
error = break_lease(inode, FMODE_WRITE);
if (error)
goto dput_and_out;
goto put_write_and_out;

error = locks_verify_truncate(inode, NULL, length);
if (!error) {
DQUOT_INIT(inode);
error = do_truncate(nd.dentry, length, 0, NULL);
}
put_write_access(inode);

put_write_and_out:
put_write_access(inode);
dput_and_out:
path_release(&nd);
out:
Expand Down

0 comments on commit 55af982

Please sign in to comment.