From 694e8346ca9e9ff53d862107a62a0d524d97e1f5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 1 Mar 2010 09:57:54 -0800 Subject: [PATCH] --- yaml --- r: 188741 b: refs/heads/master c: 195d3ce2cc9a8ec69827f6369c41b269345b9988 h: refs/heads/master i: 188739: f2cffbceb1b2fd46d5fc41dc76363400a91fb613 v: v3 --- [refs] | 2 +- trunk/fs/ceph/caps.c | 9 ++++++--- trunk/fs/ceph/file.c | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 0f2c54280c8e..15575c88dde2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6f863e712d4114e8ae2f02de64ebeac0546ebaa0 +refs/heads/master: 195d3ce2cc9a8ec69827f6369c41b269345b9988 diff --git a/trunk/fs/ceph/caps.c b/trunk/fs/ceph/caps.c index 9afa8d37a6e3..06f197983be6 100644 --- a/trunk/fs/ceph/caps.c +++ b/trunk/fs/ceph/caps.c @@ -1923,14 +1923,17 @@ static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want, struct inode *inode = &ci->vfs_inode; int ret = 0; int have, implemented; + int file_wanted; dout("get_cap_refs %p need %s want %s\n", inode, ceph_cap_string(need), ceph_cap_string(want)); spin_lock(&inode->i_lock); - /* make sure we _have_ some caps! */ - if (!__ceph_is_any_caps(ci)) { - dout("get_cap_refs %p no real caps\n", inode); + /* make sure file is actually open */ + file_wanted = __ceph_caps_file_wanted(ci); + if ((file_wanted & need) == 0) { + dout("try_get_cap_refs need %s file_wanted %s, EBADF\n", + ceph_cap_string(need), ceph_cap_string(file_wanted)); *err = -EBADF; ret = 1; goto out; diff --git a/trunk/fs/ceph/file.c b/trunk/fs/ceph/file.c index 88932c9145e9..5d2af8464f6a 100644 --- a/trunk/fs/ceph/file.c +++ b/trunk/fs/ceph/file.c @@ -262,6 +262,9 @@ int ceph_release(struct inode *inode, struct file *file) kfree(cf->dir_info); dput(cf->dentry); kmem_cache_free(ceph_file_cachep, cf); + + /* wake up anyone waiting for caps on this inode */ + wake_up(&ci->i_cap_wq); return 0; }