diff options
Diffstat (limited to 'fs/lockd/svcsubs.c')
| -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 | } |
