diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 15:05:57 -0500 |
---|---|---|
committer | Jeff Layton <jeff.layton@primarydata.com> | 2015-01-16 16:08:49 -0500 |
commit | 6109c85037e53443f29fd39c0de69f578a1cf285 (patch) | |
tree | 56823d1615acbba20c858eed9d16cf443cd55872 /fs/nfs | |
parent | a7231a97467d5a0c36f82f581c76c12c034e4b80 (diff) |
locks: add a dedicated spinlock to protect i_flctx lists
We can now add a dedicated spinlock without expanding struct inode.
Change to using that to protect the various i_flctx lists.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/delegation.c | 8 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 8 | ||||
-rw-r--r-- | fs/nfs/write.c | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 3fb1caa3874d..8cdb2b28a104 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -93,22 +93,22 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ | |||
93 | goto out; | 93 | goto out; |
94 | 94 | ||
95 | list = &flctx->flc_posix; | 95 | list = &flctx->flc_posix; |
96 | spin_lock(&inode->i_lock); | 96 | spin_lock(&flctx->flc_lock); |
97 | restart: | 97 | restart: |
98 | list_for_each_entry(fl, list, fl_list) { | 98 | list_for_each_entry(fl, list, fl_list) { |
99 | if (nfs_file_open_context(fl->fl_file) != ctx) | 99 | if (nfs_file_open_context(fl->fl_file) != ctx) |
100 | continue; | 100 | continue; |
101 | spin_unlock(&inode->i_lock); | 101 | spin_unlock(&flctx->flc_lock); |
102 | status = nfs4_lock_delegation_recall(fl, state, stateid); | 102 | status = nfs4_lock_delegation_recall(fl, state, stateid); |
103 | if (status < 0) | 103 | if (status < 0) |
104 | goto out; | 104 | goto out; |
105 | spin_lock(&inode->i_lock); | 105 | spin_lock(&flctx->flc_lock); |
106 | } | 106 | } |
107 | if (list == &flctx->flc_posix) { | 107 | if (list == &flctx->flc_posix) { |
108 | list = &flctx->flc_flock; | 108 | list = &flctx->flc_flock; |
109 | goto restart; | 109 | goto restart; |
110 | } | 110 | } |
111 | spin_unlock(&inode->i_lock); | 111 | spin_unlock(&flctx->flc_lock); |
112 | out: | 112 | out: |
113 | return status; | 113 | return status; |
114 | } | 114 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 6084c267f3a0..a3bb22ab68c5 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1376,12 +1376,12 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_ | |||
1376 | 1376 | ||
1377 | /* Guard against delegation returns and new lock/unlock calls */ | 1377 | /* Guard against delegation returns and new lock/unlock calls */ |
1378 | down_write(&nfsi->rwsem); | 1378 | down_write(&nfsi->rwsem); |
1379 | spin_lock(&inode->i_lock); | 1379 | spin_lock(&flctx->flc_lock); |
1380 | restart: | 1380 | restart: |
1381 | list_for_each_entry(fl, list, fl_list) { | 1381 | list_for_each_entry(fl, list, fl_list) { |
1382 | if (nfs_file_open_context(fl->fl_file)->state != state) | 1382 | if (nfs_file_open_context(fl->fl_file)->state != state) |
1383 | continue; | 1383 | continue; |
1384 | spin_unlock(&inode->i_lock); | 1384 | spin_unlock(&flctx->flc_lock); |
1385 | status = ops->recover_lock(state, fl); | 1385 | status = ops->recover_lock(state, fl); |
1386 | switch (status) { | 1386 | switch (status) { |
1387 | case 0: | 1387 | case 0: |
@@ -1408,13 +1408,13 @@ restart: | |||
1408 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | 1408 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
1409 | status = 0; | 1409 | status = 0; |
1410 | } | 1410 | } |
1411 | spin_lock(&inode->i_lock); | 1411 | spin_lock(&flctx->flc_lock); |
1412 | } | 1412 | } |
1413 | if (list == &flctx->flc_posix) { | 1413 | if (list == &flctx->flc_posix) { |
1414 | list = &flctx->flc_flock; | 1414 | list = &flctx->flc_flock; |
1415 | goto restart; | 1415 | goto restart; |
1416 | } | 1416 | } |
1417 | spin_unlock(&inode->i_lock); | 1417 | spin_unlock(&flctx->flc_lock); |
1418 | out: | 1418 | out: |
1419 | up_write(&nfsi->rwsem); | 1419 | up_write(&nfsi->rwsem); |
1420 | return status; | 1420 | return status; |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 784c13485b3f..4ae66f416eb9 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1206,7 +1206,7 @@ static int nfs_can_extend_write(struct file *file, struct page *page, struct ino | |||
1206 | 1206 | ||
1207 | /* Check to see if there are whole file write locks */ | 1207 | /* Check to see if there are whole file write locks */ |
1208 | ret = 0; | 1208 | ret = 0; |
1209 | spin_lock(&inode->i_lock); | 1209 | spin_lock(&flctx->flc_lock); |
1210 | if (!list_empty(&flctx->flc_posix)) { | 1210 | if (!list_empty(&flctx->flc_posix)) { |
1211 | fl = list_first_entry(&flctx->flc_posix, struct file_lock, | 1211 | fl = list_first_entry(&flctx->flc_posix, struct file_lock, |
1212 | fl_list); | 1212 | fl_list); |
@@ -1218,7 +1218,7 @@ static int nfs_can_extend_write(struct file *file, struct page *page, struct ino | |||
1218 | if (fl->fl_type == F_WRLCK) | 1218 | if (fl->fl_type == F_WRLCK) |
1219 | ret = 1; | 1219 | ret = 1; |
1220 | } | 1220 | } |
1221 | spin_unlock(&inode->i_lock); | 1221 | spin_unlock(&flctx->flc_lock); |
1222 | return ret; | 1222 | return ret; |
1223 | } | 1223 | } |
1224 | 1224 | ||