diff mbox

mds: issue caps on file update finish if no client cap specified

Message ID 1305110696-2688-1-git-send-email-henry.cy.chang@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Henry Chang May 11, 2011, 10:44 a.m. UTC
Fix the following scenario that happens occasionally when running
blogbench:

client released caps on one inode. Then, the inode's ifile was wrlocked
during updating client range. Before the update had finished, client
re-opened the file again for reading. Since ifile was wrlocked, the client
was not given the Fr cap and was blocked on reading forever.

Signed-off-by: Henry C Chang <henry.cy.chang@gmail.com>
---
 src/mds/Locker.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Sage Weil May 11, 2011, 5:40 p.m. UTC | #1
On Wed, 11 May 2011, Henry C Chang wrote:

> Fix the following scenario that happens occasionally when running
> blogbench:
> 
> client released caps on one inode. Then, the inode's ifile was wrlocked
> during updating client range. Before the update had finished, client
> re-opened the file again for reading. Since ifile was wrlocked, the client
> was not given the Fr cap and was blocked on reading forever.

This one I'm not sure about.  Do you have an MDS log for this case?  I 
would expect the cap issue to happen when we drop_locks(mut) and the lock 
state changes.

sage


> 
> Signed-off-by: Henry C Chang <henry.cy.chang@gmail.com>
> ---
>  src/mds/Locker.cc |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
> index 3c7c190..36da98e 100644
> --- a/src/mds/Locker.cc
> +++ b/src/mds/Locker.cc
> @@ -1242,7 +1242,7 @@ void Locker::file_update_finish(CInode *in, Mutation *mut, bool share, client_t
>      if (gather)
>        eval_cap_gather(in);
>    } else {
> -    if (cap && (cap->wanted() & ~cap->pending())) {
> +    if (!cap || (cap && (cap->wanted() & ~cap->pending()))) {
>        issue_caps(in, cap);
>      }
>    
> -- 
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Henry Chang May 12, 2011, 1:30 a.m. UTC | #2
> This one I'm not sure about.  Do you have an MDS log for this case?  I
> would expect the cap issue to happen when we drop_locks(mut) and the lock
> state changes.
>

OK. I'll try to reproduce it with debug log on.

Henry
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Henry Chang May 12, 2011, 3:08 a.m. UTC | #3
I created a ticket - http://tracker.newdream.net/issues/1084 and
uploaded the mds log where I found the problem.
(Full log is huge. I just uploaded the critical part. Let me know if
you need the full one.)

Henry

2011/5/12 Henry C Chang <henry.cy.chang@gmail.com>:
>> This one I'm not sure about.  Do you have an MDS log for this case?  I
>> would expect the cap issue to happen when we drop_locks(mut) and the lock
>> state changes.
>>
>
> OK. I'll try to reproduce it with debug log on.
>
> Henry
>
diff mbox

Patch

diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc
index 3c7c190..36da98e 100644
--- a/src/mds/Locker.cc
+++ b/src/mds/Locker.cc
@@ -1242,7 +1242,7 @@  void Locker::file_update_finish(CInode *in, Mutation *mut, bool share, client_t
     if (gather)
       eval_cap_gather(in);
   } else {
-    if (cap && (cap->wanted() & ~cap->pending())) {
+    if (!cap || (cap && (cap->wanted() & ~cap->pending()))) {
       issue_caps(in, cap);
     }