diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-09-06 11:09:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-09-06 11:27:41 -0400 |
commit | 4109bb7496640aa97a12904527ba8e3a19b7ce7a (patch) | |
tree | 42c548343233be325bdc0cb337c692bf728288b1 /fs/nfs | |
parent | 0f1d26055068bbc66751d1974ecc6f0398b3ac67 (diff) |
NFS: Don't check lock owner compatability unless file is locked (part 2)
When coalescing requests into a single READ or WRITE RPC call, and there
is no file locking involved, we don't have to refuse coalescing for
requests where the lock owner information doesn't match.
Reported-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/pagelist.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 29cfb7ade121..2ffebf2081ce 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -328,6 +328,19 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc, | |||
328 | } | 328 | } |
329 | EXPORT_SYMBOL_GPL(nfs_pageio_init); | 329 | EXPORT_SYMBOL_GPL(nfs_pageio_init); |
330 | 330 | ||
331 | static bool nfs_match_open_context(const struct nfs_open_context *ctx1, | ||
332 | const struct nfs_open_context *ctx2) | ||
333 | { | ||
334 | return ctx1->cred == ctx2->cred && ctx1->state == ctx2->state; | ||
335 | } | ||
336 | |||
337 | static bool nfs_match_lock_context(const struct nfs_lock_context *l1, | ||
338 | const struct nfs_lock_context *l2) | ||
339 | { | ||
340 | return l1->lockowner.l_owner == l2->lockowner.l_owner | ||
341 | && l1->lockowner.l_pid == l2->lockowner.l_pid; | ||
342 | } | ||
343 | |||
331 | /** | 344 | /** |
332 | * nfs_can_coalesce_requests - test two requests for compatibility | 345 | * nfs_can_coalesce_requests - test two requests for compatibility |
333 | * @prev: pointer to nfs_page | 346 | * @prev: pointer to nfs_page |
@@ -343,13 +356,10 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, | |||
343 | struct nfs_page *req, | 356 | struct nfs_page *req, |
344 | struct nfs_pageio_descriptor *pgio) | 357 | struct nfs_pageio_descriptor *pgio) |
345 | { | 358 | { |
346 | if (req->wb_context->cred != prev->wb_context->cred) | 359 | if (!nfs_match_open_context(req->wb_context, prev->wb_context)) |
347 | return false; | ||
348 | if (req->wb_lock_context->lockowner.l_owner != prev->wb_lock_context->lockowner.l_owner) | ||
349 | return false; | ||
350 | if (req->wb_lock_context->lockowner.l_pid != prev->wb_lock_context->lockowner.l_pid) | ||
351 | return false; | 360 | return false; |
352 | if (req->wb_context->state != prev->wb_context->state) | 361 | if (req->wb_context->dentry->d_inode->i_flock != NULL && |
362 | !nfs_match_lock_context(req->wb_lock_context, prev->wb_lock_context)) | ||
353 | return false; | 363 | return false; |
354 | if (req->wb_pgbase != 0) | 364 | if (req->wb_pgbase != 0) |
355 | return false; | 365 | return false; |