diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-10 18:34:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-10 18:34:42 -0500 |
commit | 4b4f8580a4b77126733db8072862793d4deae66a (patch) | |
tree | 0d6ab49f4fe61ca96fd513b6dfae8be541796320 /fs/lockd | |
parent | 872912352c5be930e9568e5f3b6d73107d9f278d (diff) | |
parent | 8116bf4cb62d337c953cfa5369ef4cf83e73140c (diff) |
Merge tag 'locks-v3.20-1' of git://git.samba.org/jlayton/linux
Pull file locking related changes #1 from Jeff Layton:
"This patchset contains a fairly major overhaul of how file locks are
tracked within the inode. Rather than a single list, we now create a
per-inode "lock context" that contains individual lists for the file
locks, and a new dedicated spinlock for them.
There are changes in other trees that are based on top of this set so
it may be easiest to pull this in early"
* tag 'locks-v3.20-1' of git://git.samba.org/jlayton/linux:
locks: update comments that refer to inode->i_flock
locks: consolidate NULL i_flctx checks in locks_remove_file
locks: keep a count of locks on the flctx lists
locks: clean up the lm_change prototype
locks: add a dedicated spinlock to protect i_flctx lists
locks: remove i_flock field from struct inode
locks: convert lease handling to file_lock_context
locks: convert posix locks to file_lock_context
locks: move flock locks to file_lock_context
ceph: move spinlocking into ceph_encode_locks_to_buffer and ceph_count_locks
locks: add a new struct file_locking_context pointer to struct inode
locks: have locks_release_file use flock_lock_file to release generic flock locks
locks: add new struct list_head to struct file_lock
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/svcsubs.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index d12ff4e2dbe7..665ef5a05183 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -164,12 +164,15 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file, | |||
164 | { | 164 | { |
165 | struct inode *inode = nlmsvc_file_inode(file); | 165 | struct inode *inode = nlmsvc_file_inode(file); |
166 | struct file_lock *fl; | 166 | struct file_lock *fl; |
167 | struct file_lock_context *flctx = inode->i_flctx; | ||
167 | struct nlm_host *lockhost; | 168 | struct nlm_host *lockhost; |
168 | 169 | ||
170 | if (!flctx || list_empty_careful(&flctx->flc_posix)) | ||
171 | return 0; | ||
169 | again: | 172 | again: |
170 | file->f_locks = 0; | 173 | file->f_locks = 0; |
171 | spin_lock(&inode->i_lock); | 174 | spin_lock(&flctx->flc_lock); |
172 | for (fl = inode->i_flock; fl; fl = fl->fl_next) { | 175 | list_for_each_entry(fl, &flctx->flc_posix, fl_list) { |
173 | if (fl->fl_lmops != &nlmsvc_lock_operations) | 176 | if (fl->fl_lmops != &nlmsvc_lock_operations) |
174 | continue; | 177 | continue; |
175 | 178 | ||
@@ -180,7 +183,7 @@ again: | |||
180 | if (match(lockhost, host)) { | 183 | if (match(lockhost, host)) { |
181 | struct file_lock lock = *fl; | 184 | struct file_lock lock = *fl; |
182 | 185 | ||
183 | spin_unlock(&inode->i_lock); | 186 | spin_unlock(&flctx->flc_lock); |
184 | lock.fl_type = F_UNLCK; | 187 | lock.fl_type = F_UNLCK; |
185 | lock.fl_start = 0; | 188 | lock.fl_start = 0; |
186 | lock.fl_end = OFFSET_MAX; | 189 | lock.fl_end = OFFSET_MAX; |
@@ -192,7 +195,7 @@ again: | |||
192 | goto again; | 195 | goto again; |
193 | } | 196 | } |
194 | } | 197 | } |
195 | spin_unlock(&inode->i_lock); | 198 | spin_unlock(&flctx->flc_lock); |
196 | 199 | ||
197 | return 0; | 200 | return 0; |
198 | } | 201 | } |
@@ -223,18 +226,21 @@ nlm_file_inuse(struct nlm_file *file) | |||
223 | { | 226 | { |
224 | struct inode *inode = nlmsvc_file_inode(file); | 227 | struct inode *inode = nlmsvc_file_inode(file); |
225 | struct file_lock *fl; | 228 | struct file_lock *fl; |
229 | struct file_lock_context *flctx = inode->i_flctx; | ||
226 | 230 | ||
227 | if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares) | 231 | if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares) |
228 | return 1; | 232 | return 1; |
229 | 233 | ||
230 | spin_lock(&inode->i_lock); | 234 | if (flctx && !list_empty_careful(&flctx->flc_posix)) { |
231 | for (fl = inode->i_flock; fl; fl = fl->fl_next) { | 235 | spin_lock(&flctx->flc_lock); |
232 | if (fl->fl_lmops == &nlmsvc_lock_operations) { | 236 | list_for_each_entry(fl, &flctx->flc_posix, fl_list) { |
233 | spin_unlock(&inode->i_lock); | 237 | if (fl->fl_lmops == &nlmsvc_lock_operations) { |
234 | return 1; | 238 | spin_unlock(&flctx->flc_lock); |
239 | return 1; | ||
240 | } | ||
235 | } | 241 | } |
242 | spin_unlock(&flctx->flc_lock); | ||
236 | } | 243 | } |
237 | spin_unlock(&inode->i_lock); | ||
238 | file->f_locks = 0; | 244 | file->f_locks = 0; |
239 | return 0; | 245 | return 0; |
240 | } | 246 | } |