diff options
author | Luis Henriques <lhenriques@suse.com> | 2018-10-15 11:45:57 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-10-22 04:28:23 -0400 |
commit | 2ee9dd958d474252510b8c4dc216aa1dab7ad272 (patch) | |
tree | 176b6bb4260127b5c1ea310c5e742dfc2785f1af /fs/ceph/caps.c | |
parent | 98c4bfe9d89b22d7bfddf6469241658920b6fafe (diff) |
ceph: add non-blocking parameter to ceph_try_get_caps()
ceph_try_get_caps currently calls try_get_cap_refs with the nonblock
parameter always set to 'true'. This change adds a new parameter that
allows to set it's value. This will be useful for a follow-up patch that
will need to get two sets of capabilities for two different inodes without
risking a deadlock.
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index f36946fdfb00..f3496db4bb3e 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2673,17 +2673,18 @@ static void check_max_size(struct inode *inode, loff_t endoff) | |||
2673 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 2673 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
2674 | } | 2674 | } |
2675 | 2675 | ||
2676 | int ceph_try_get_caps(struct ceph_inode_info *ci, int need, int want, int *got) | 2676 | int ceph_try_get_caps(struct ceph_inode_info *ci, int need, int want, |
2677 | bool nonblock, int *got) | ||
2677 | { | 2678 | { |
2678 | int ret, err = 0; | 2679 | int ret, err = 0; |
2679 | 2680 | ||
2680 | BUG_ON(need & ~CEPH_CAP_FILE_RD); | 2681 | BUG_ON(need & ~CEPH_CAP_FILE_RD); |
2681 | BUG_ON(want & ~(CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)); | 2682 | BUG_ON(want & ~(CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO|CEPH_CAP_FILE_SHARED)); |
2682 | ret = ceph_pool_perm_check(ci, need); | 2683 | ret = ceph_pool_perm_check(ci, need); |
2683 | if (ret < 0) | 2684 | if (ret < 0) |
2684 | return ret; | 2685 | return ret; |
2685 | 2686 | ||
2686 | ret = try_get_cap_refs(ci, need, want, 0, true, got, &err); | 2687 | ret = try_get_cap_refs(ci, need, want, 0, nonblock, got, &err); |
2687 | if (ret) { | 2688 | if (ret) { |
2688 | if (err == -EAGAIN) { | 2689 | if (err == -EAGAIN) { |
2689 | ret = 0; | 2690 | ret = 0; |