Skip to content

Commit

Permalink
ceph: fix open for write on clustered mds
Browse files Browse the repository at this point in the history
Normally when we open a file we already have a cap, and simply update the
wanted set.  However, if we open a file for write, but don't have an auth
cap, that doesn't work; we need to open a new cap with the auth MDS.  Only
reuse existing caps if we are opening for read or the existing cap is auth.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Nov 7, 2010
1 parent d8b16b3 commit 7421ab8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ int ceph_open(struct inode *inode, struct file *file)
}

/*
* No need to block if we have any caps. Update wanted set
* No need to block if we have caps on the auth MDS (for
* write) or any MDS (for read). Update wanted set
* asynchronously.
*/
spin_lock(&inode->i_lock);
if (__ceph_is_any_real_caps(ci)) {
if (__ceph_is_any_real_caps(ci) &&
(((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) {
int mds_wanted = __ceph_caps_mds_wanted(ci);
int issued = __ceph_caps_issued(ci, NULL);

Expand Down

0 comments on commit 7421ab8

Please sign in to comment.