diff options
author | Yan, Zheng <zyan@redhat.com> | 2015-01-04 22:04:04 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-02-19 05:31:37 -0500 |
commit | 03f4fcb02884859b584c709652bb48f8125ceb45 (patch) | |
tree | a65b5f4bb6661d17b9a9bdacf7b1c27ddff33137 /fs/ceph/caps.c | |
parent | f646912d1044ace6c6c5b5785b2579177781873b (diff) |
ceph: handle SESSION_FORCE_RO message
mark session as readonly and wake up all cap waiters.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index b93c631c6c87..d0618e8412fd 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2143,6 +2143,21 @@ again: | |||
2143 | ret = 1; | 2143 | ret = 1; |
2144 | } | 2144 | } |
2145 | } else { | 2145 | } else { |
2146 | int session_readonly = false; | ||
2147 | if ((need & CEPH_CAP_FILE_WR) && ci->i_auth_cap) { | ||
2148 | struct ceph_mds_session *s = ci->i_auth_cap->session; | ||
2149 | spin_lock(&s->s_cap_lock); | ||
2150 | session_readonly = s->s_readonly; | ||
2151 | spin_unlock(&s->s_cap_lock); | ||
2152 | } | ||
2153 | if (session_readonly) { | ||
2154 | dout("get_cap_refs %p needed %s but mds%d readonly\n", | ||
2155 | inode, ceph_cap_string(need), ci->i_auth_cap->mds); | ||
2156 | *err = -EROFS; | ||
2157 | ret = 1; | ||
2158 | goto out_unlock; | ||
2159 | } | ||
2160 | |||
2146 | dout("get_cap_refs %p have %s needed %s\n", inode, | 2161 | dout("get_cap_refs %p have %s needed %s\n", inode, |
2147 | ceph_cap_string(have), ceph_cap_string(need)); | 2162 | ceph_cap_string(have), ceph_cap_string(need)); |
2148 | } | 2163 | } |