Skip to content

Commit 8006daf

Browse files
jtlaytonidryomov
authored andcommitted
ceph: don't use -ESTALE as special return code in try_get_cap_refs
In some cases, we may want to return -ESTALE if it ends up that we're dealing with an inode that no longer exists. Switch to using -EUCLEAN as the "special" error return. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 6407fbb commit 8006daf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/ceph/caps.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,9 +2630,9 @@ void ceph_take_cap_refs(struct ceph_inode_info *ci, int got,
26302630
*
26312631
* Returns 0 if caps were not able to be acquired (yet), 1 if succeed,
26322632
* or a negative error code. There are 3 speical error codes:
2633-
* -EAGAIN: need to sleep but non-blocking is specified
2634-
* -EFBIG: ask caller to call check_max_size() and try again.
2635-
* -ESTALE: ask caller to call ceph_renew_caps() and try again.
2633+
* -EAGAIN: need to sleep but non-blocking is specified
2634+
* -EFBIG: ask caller to call check_max_size() and try again.
2635+
* -EUCLEAN: ask caller to call ceph_renew_caps() and try again.
26362636
*/
26372637
enum {
26382638
/* first 8 bits are reserved for CEPH_FILE_MODE_FOO */
@@ -2680,7 +2680,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
26802680
dout("get_cap_refs %p endoff %llu > maxsize %llu\n",
26812681
inode, endoff, ci->i_max_size);
26822682
if (endoff > ci->i_requested_max_size)
2683-
ret = ci->i_auth_cap ? -EFBIG : -ESTALE;
2683+
ret = ci->i_auth_cap ? -EFBIG : -EUCLEAN;
26842684
goto out_unlock;
26852685
}
26862686
/*
@@ -2760,7 +2760,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
27602760
dout("get_cap_refs %p need %s > mds_wanted %s\n",
27612761
inode, ceph_cap_string(need),
27622762
ceph_cap_string(mds_wanted));
2763-
ret = -ESTALE;
2763+
ret = -EUCLEAN;
27642764
goto out_unlock;
27652765
}
27662766

@@ -2844,7 +2844,7 @@ int ceph_try_get_caps(struct inode *inode, int need, int want,
28442844

28452845
ret = try_get_cap_refs(inode, need, want, 0, flags, got);
28462846
/* three special error codes */
2847-
if (ret == -EAGAIN || ret == -EFBIG || ret == -ESTALE)
2847+
if (ret == -EAGAIN || ret == -EFBIG || ret == -EUCLEAN)
28482848
ret = 0;
28492849
return ret;
28502850
}
@@ -2927,7 +2927,7 @@ int ceph_get_caps(struct file *filp, int need, int want, loff_t endoff, int *got
29272927
}
29282928

29292929
if (ret < 0) {
2930-
if (ret == -EFBIG || ret == -ESTALE) {
2930+
if (ret == -EFBIG || ret == -EUCLEAN) {
29312931
int ret2 = ceph_wait_on_async_create(inode);
29322932
if (ret2 < 0)
29332933
return ret2;
@@ -2936,7 +2936,7 @@ int ceph_get_caps(struct file *filp, int need, int want, loff_t endoff, int *got
29362936
check_max_size(inode, endoff);
29372937
continue;
29382938
}
2939-
if (ret == -ESTALE) {
2939+
if (ret == -EUCLEAN) {
29402940
/* session was killed, try renew caps */
29412941
ret = ceph_renew_caps(inode, flags);
29422942
if (ret == 0)

0 commit comments

Comments
 (0)