diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-24 06:47:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-03 13:00:21 -0500 |
commit | 8737c9305bd5602b11f7eb4655d5695d4a42a0c6 (patch) | |
tree | 54038cac1135b039a292151ebe9b156f80904843 /fs/locks.c | |
parent | d208bbdda991b8808d9c033ce4d31cb1bd87dcfc (diff) |
Switch may_open() and break_lease() to passing O_...
... instead of mixing FMODE_ and O_
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/locks.c b/fs/locks.c index a8794f233bc9..ae9ded026b7c 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1182,8 +1182,9 @@ int __break_lease(struct inode *inode, unsigned int mode) | |||
1182 | struct file_lock *fl; | 1182 | struct file_lock *fl; |
1183 | unsigned long break_time; | 1183 | unsigned long break_time; |
1184 | int i_have_this_lease = 0; | 1184 | int i_have_this_lease = 0; |
1185 | int want_write = (mode & O_ACCMODE) != O_RDONLY; | ||
1185 | 1186 | ||
1186 | new_fl = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK); | 1187 | new_fl = lease_alloc(NULL, want_write ? F_WRLCK : F_RDLCK); |
1187 | 1188 | ||
1188 | lock_kernel(); | 1189 | lock_kernel(); |
1189 | 1190 | ||
@@ -1197,7 +1198,7 @@ int __break_lease(struct inode *inode, unsigned int mode) | |||
1197 | if (fl->fl_owner == current->files) | 1198 | if (fl->fl_owner == current->files) |
1198 | i_have_this_lease = 1; | 1199 | i_have_this_lease = 1; |
1199 | 1200 | ||
1200 | if (mode & FMODE_WRITE) { | 1201 | if (want_write) { |
1201 | /* If we want write access, we have to revoke any lease. */ | 1202 | /* If we want write access, we have to revoke any lease. */ |
1202 | future = F_UNLCK | F_INPROGRESS; | 1203 | future = F_UNLCK | F_INPROGRESS; |
1203 | } else if (flock->fl_type & F_INPROGRESS) { | 1204 | } else if (flock->fl_type & F_INPROGRESS) { |