Skip to content

Commit 7055fa5

Browse files
committed
mds: use system error codes instead of CEPHFS_EXX codes
Signed-off-by: Igor Golikov <[email protected]> Fixes: https://tracker.ceph.com/issues/64611
1 parent bd3b248 commit 7055fa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1314
-1312
lines changed

src/client/Client.cc

Lines changed: 374 additions & 374 deletions
Large diffs are not rendered by default.

src/client/Client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class Client : public Dispatcher, public md_config_obs_t {
380380

381381
/**
382382
* Returns the length of the buffer that got filled in, or -errno.
383-
* If it returns -CEPHFS_ERANGE you just need to increase the size of the
383+
* If it returns -ERANGE you just need to increase the size of the
384384
* buffer and try again.
385385
*/
386386
int _getdents(dir_result_t *dirp, char *buf, int buflen, bool ful); // get a bunch of dentries at once
@@ -1890,7 +1890,7 @@ class Client : public Dispatcher, public md_config_obs_t {
18901890
ino_t last_used_faked_ino;
18911891
ino_t last_used_faked_root;
18921892

1893-
int local_osd = -CEPHFS_ENXIO;
1893+
int local_osd = -ENXIO;
18941894
epoch_t local_osd_epoch = 0;
18951895

18961896
// mds requests

src/client/Inode.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -704,13 +704,13 @@ int Inode::set_deleg(Fh *fh, unsigned type, ceph_deleg_cb_t cb, void *priv)
704704
* allow it, with an unusual error to make it clear.
705705
*/
706706
if (!client->get_deleg_timeout())
707-
return -CEPHFS_ETIME;
707+
return -ETIME;
708708

709709
// Just say no if we have any recalled delegs still outstanding
710710
if (has_recalled_deleg()) {
711711
lsubdout(client->cct, client, 10) << __func__ <<
712712
": has_recalled_deleg" << dendl;
713-
return -CEPHFS_EAGAIN;
713+
return -EAGAIN;
714714
}
715715

716716
// check vs. currently open files on this inode
@@ -719,17 +719,17 @@ int Inode::set_deleg(Fh *fh, unsigned type, ceph_deleg_cb_t cb, void *priv)
719719
if (open_count_for_write()) {
720720
lsubdout(client->cct, client, 10) << __func__ <<
721721
": open for write" << dendl;
722-
return -CEPHFS_EAGAIN;
722+
return -EAGAIN;
723723
}
724724
break;
725725
case CEPH_DELEGATION_WR:
726726
if (open_count() > 1) {
727727
lsubdout(client->cct, client, 10) << __func__ << ": open" << dendl;
728-
return -CEPHFS_EAGAIN;
728+
return -EAGAIN;
729729
}
730730
break;
731731
default:
732-
return -CEPHFS_EINVAL;
732+
return -EINVAL;
733733
}
734734

735735
/*
@@ -750,7 +750,7 @@ int Inode::set_deleg(Fh *fh, unsigned type, ceph_deleg_cb_t cb, void *priv)
750750
if (!caps_issued_mask(need)) {
751751
lsubdout(client->cct, client, 10) << __func__ << ": cap mismatch, have="
752752
<< ccap_string(caps_issued()) << " need=" << ccap_string(need) << dendl;
753-
return -CEPHFS_EAGAIN;
753+
return -EAGAIN;
754754
}
755755

756756
for (list<Delegation>::iterator d = delegations.begin();

src/client/fuse_ll.cc

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -85,43 +85,43 @@ struct ceph_fuse_fake_inode_stag {
8585
using namespace std;
8686

8787
static const ceph::unordered_map<int,int> cephfs_errno_to_system_errno = {
88-
{CEPHFS_EBLOCKLISTED, ESHUTDOWN},
89-
{CEPHFS_EPERM, EPERM},
90-
{CEPHFS_ESTALE, ESTALE},
91-
{CEPHFS_ENOSPC, ENOSPC},
92-
{CEPHFS_ETIMEDOUT, ETIMEDOUT},
93-
{CEPHFS_EIO, EIO},
94-
{CEPHFS_ENOTCONN, ENOTCONN},
95-
{CEPHFS_EEXIST, EEXIST},
96-
{CEPHFS_EINTR, EINTR},
97-
{CEPHFS_EINVAL, EINVAL},
98-
{CEPHFS_EBADF, EBADF},
99-
{CEPHFS_EROFS, EROFS},
100-
{CEPHFS_EAGAIN, EAGAIN},
101-
{CEPHFS_EACCES, EACCES},
102-
{CEPHFS_ELOOP, ELOOP},
103-
{CEPHFS_EISDIR, EISDIR},
104-
{CEPHFS_ENOENT, ENOENT},
105-
{CEPHFS_ENOTDIR, ENOTDIR},
106-
{CEPHFS_ENAMETOOLONG, ENAMETOOLONG},
107-
{CEPHFS_EBUSY, EBUSY},
108-
{CEPHFS_EDQUOT, EDQUOT},
109-
{CEPHFS_EFBIG, EFBIG},
110-
{CEPHFS_ERANGE, ERANGE},
111-
{CEPHFS_ENXIO, ENXIO},
112-
{CEPHFS_ECANCELED, ECANCELED},
113-
{CEPHFS_ENODATA, ENODATA},
114-
{CEPHFS_EOPNOTSUPP, EOPNOTSUPP},
115-
{CEPHFS_EXDEV, EXDEV},
116-
{CEPHFS_ENOMEM, ENOMEM},
117-
{CEPHFS_ENOTRECOVERABLE, ENOTRECOVERABLE},
118-
{CEPHFS_ENOSYS, ENOSYS},
119-
{CEPHFS_ENOTEMPTY, ENOTEMPTY},
120-
{CEPHFS_EDEADLK, EDEADLK},
121-
{CEPHFS_EDOM, EDOM},
122-
{CEPHFS_EMLINK, EMLINK},
123-
{CEPHFS_ETIME, ETIME},
124-
{CEPHFS_EOLDSNAPC, EIO} // forcing to EIO for now
88+
{EBLOCKLISTED, ESHUTDOWN},
89+
{EPERM, EPERM},
90+
{ESTALE, ESTALE},
91+
{ENOSPC, ENOSPC},
92+
{ETIMEDOUT, ETIMEDOUT},
93+
{EIO, EIO},
94+
{ENOTCONN, ENOTCONN},
95+
{EEXIST, EEXIST},
96+
{EINTR, EINTR},
97+
{EINVAL, EINVAL},
98+
{EBADF, EBADF},
99+
{EROFS, EROFS},
100+
{EAGAIN, EAGAIN},
101+
{EACCES, EACCES},
102+
{ELOOP, ELOOP},
103+
{EISDIR, EISDIR},
104+
{ENOENT, ENOENT},
105+
{ENOTDIR, ENOTDIR},
106+
{ENAMETOOLONG, ENAMETOOLONG},
107+
{EBUSY, EBUSY},
108+
{EDQUOT, EDQUOT},
109+
{EFBIG, EFBIG},
110+
{ERANGE, ERANGE},
111+
{ENXIO, ENXIO},
112+
{ECANCELED, ECANCELED},
113+
{ENODATA, ENODATA},
114+
{EOPNOTSUPP, EOPNOTSUPP},
115+
{EXDEV, EXDEV},
116+
{ENOMEM, ENOMEM},
117+
{ENOTRECOVERABLE, ENOTRECOVERABLE},
118+
{ENOSYS, ENOSYS},
119+
{ENOTEMPTY, ENOTEMPTY},
120+
{EDEADLK, EDEADLK},
121+
{EDOM, EDOM},
122+
{EMLINK, EMLINK},
123+
{ETIME, ETIME},
124+
{EOLDSNAPC, EIO} // forcing to EIO for now
125125
};
126126

127127
/* Requirements:
@@ -283,7 +283,7 @@ static int getgroups(fuse_req_t req, gid_t **sgids)
283283

284284
gid_t *gids = new (std::nothrow) gid_t[c];
285285
if (!gids) {
286-
return -get_sys_errno(CEPHFS_ENOMEM);
286+
return -get_sys_errno(ENOMEM);
287287
}
288288
c = fuse_req_getgroups(req, c, gids);
289289
if (c < 0) {
@@ -293,7 +293,7 @@ static int getgroups(fuse_req_t req, gid_t **sgids)
293293
}
294294
return c;
295295
#endif
296-
return -get_sys_errno(CEPHFS_ENOSYS);
296+
return -get_sys_errno(ENOSYS);
297297
}
298298

299299
static void get_fuse_groups(UserPerm& perms, fuse_req_t req)
@@ -379,7 +379,7 @@ static void fuse_ll_getattr(fuse_req_t req, fuse_ino_t ino,
379379
UserPerm perms(ctx->uid, ctx->gid);
380380
Inode *in = cfuse->iget(ino);
381381
if (!in) {
382-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
382+
fuse_reply_err(req, get_sys_errno(EINVAL));
383383
return;
384384
}
385385

@@ -406,7 +406,7 @@ static void fuse_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
406406
UserPerm perms(ctx->uid, ctx->gid);
407407
Inode *in = cfuse->iget(ino);
408408
if (!in) {
409-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
409+
fuse_reply_err(req, get_sys_errno(EINVAL));
410410
return;
411411
}
412412

@@ -448,7 +448,7 @@ static void fuse_ll_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
448448
UserPerm perms(ctx->uid, ctx->gid);
449449
Inode *in = cfuse->iget(ino);
450450
if (!in) {
451-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
451+
fuse_reply_err(req, get_sys_errno(EINVAL));
452452
return;
453453
}
454454

@@ -468,7 +468,7 @@ static void fuse_ll_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size)
468468
UserPerm perms(ctx->uid, ctx->gid);
469469
Inode *in = cfuse->iget(ino);
470470
if (!in) {
471-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
471+
fuse_reply_err(req, get_sys_errno(EINVAL));
472472
return;
473473
}
474474

@@ -498,7 +498,7 @@ static void fuse_ll_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
498498
UserPerm perms(ctx->uid, ctx->gid);
499499
Inode *in = cfuse->iget(ino);
500500
if (!in) {
501-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
501+
fuse_reply_err(req, get_sys_errno(EINVAL));
502502
return;
503503
}
504504

@@ -523,7 +523,7 @@ static void fuse_ll_removexattr(fuse_req_t req, fuse_ino_t ino,
523523
UserPerm perms(ctx->uid, ctx->gid);
524524
Inode *in = cfuse->iget(ino);
525525
if (!in) {
526-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
526+
fuse_reply_err(req, get_sys_errno(EINVAL));
527527
return;
528528
}
529529

@@ -544,7 +544,7 @@ static void fuse_ll_opendir(fuse_req_t req, fuse_ino_t ino,
544544
void *dirp;
545545
Inode *in = cfuse->iget(ino);
546546
if (!in) {
547-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
547+
fuse_reply_err(req, get_sys_errno(EINVAL));
548548
return;
549549
}
550550

@@ -570,7 +570,7 @@ static void fuse_ll_readlink(fuse_req_t req, fuse_ino_t ino)
570570
UserPerm perms(ctx->uid, ctx->gid);
571571
Inode *in = cfuse->iget(ino);
572572
if (!in) {
573-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
573+
fuse_reply_err(req, get_sys_errno(EINVAL));
574574
return;
575575
}
576576

@@ -595,7 +595,7 @@ static void fuse_ll_mknod(fuse_req_t req, fuse_ino_t parent, const char *name,
595595
UserPerm perms(ctx->uid, ctx->gid);
596596
Inode *i2, *i1 = cfuse->iget(parent);
597597
if (!i1) {
598-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
598+
fuse_reply_err(req, get_sys_errno(EINVAL));
599599
return;
600600
}
601601

@@ -659,7 +659,7 @@ static void fuse_ll_mkdir(fuse_req_t req, fuse_ino_t parent, const char *name,
659659

660660
i1 = cfuse->iget(parent);
661661
if (!i1) {
662-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
662+
fuse_reply_err(req, get_sys_errno(EINVAL));
663663
return;
664664
}
665665

@@ -684,7 +684,7 @@ static void fuse_ll_unlink(fuse_req_t req, fuse_ino_t parent, const char *name)
684684
UserPerm perm(ctx->uid, ctx->gid);
685685
Inode *in = cfuse->iget(parent);
686686
if (!in) {
687-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
687+
fuse_reply_err(req, get_sys_errno(EINVAL));
688688
return;
689689
}
690690

@@ -703,7 +703,7 @@ static void fuse_ll_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name)
703703
UserPerm perms(ctx->uid, ctx->gid);
704704
Inode *in = cfuse->iget(parent);
705705
if (!in) {
706-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
706+
fuse_reply_err(req, get_sys_errno(EINVAL));
707707
return;
708708
}
709709

@@ -724,7 +724,7 @@ static void fuse_ll_symlink(fuse_req_t req, const char *existing,
724724
UserPerm perms(ctx->uid, ctx->gid);
725725
Inode *i2, *i1 = cfuse->iget(parent);
726726
if (!i1) {
727-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
727+
fuse_reply_err(req, get_sys_errno(EINVAL));
728728
return;
729729
}
730730

@@ -757,7 +757,7 @@ static void fuse_ll_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
757757
// cephfs does not support renameat2 flavors; follow same logic as done in
758758
// kclient's ceph_rename()
759759
if (flags) {
760-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
760+
fuse_reply_err(req, get_sys_errno(EINVAL));
761761
return;
762762
}
763763
#endif
@@ -768,7 +768,7 @@ static void fuse_ll_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
768768
Inode *in = cfuse->iget(parent);
769769
Inode *nin = cfuse->iget(newparent);
770770
if (!in || !nin) {
771-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
771+
fuse_reply_err(req, get_sys_errno(EINVAL));
772772
return;
773773
}
774774

@@ -790,7 +790,7 @@ static void fuse_ll_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
790790
Inode *in = cfuse->iget(ino);
791791
Inode *nin = cfuse->iget(newparent);
792792
if (!in || !nin) {
793-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
793+
fuse_reply_err(req, get_sys_errno(EINVAL));
794794
return;
795795
}
796796

@@ -836,7 +836,7 @@ static void fuse_ll_open(fuse_req_t req, fuse_ino_t ino,
836836
UserPerm perms(ctx->uid, ctx->gid);
837837
Inode *in = cfuse->iget(ino);
838838
if (!in) {
839-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
839+
fuse_reply_err(req, get_sys_errno(EINVAL));
840840
return;
841841
}
842842

@@ -1033,15 +1033,15 @@ static void fuse_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
10331033
rc.req = req;
10341034
rc.snap = cfuse->fino_snap(ino);
10351035
if (rc.snap == CEPH_MAXSNAP) {
1036-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
1036+
fuse_reply_err(req, get_sys_errno(EINVAL));
10371037
return;
10381038
}
10391039
rc.buf = new char[size];
10401040
rc.size = size;
10411041
rc.pos = 0;
10421042

10431043
int r = cfuse->client->readdir_r_cb(dirp, fuse_ll_add_dirent, &rc);
1044-
if (r == 0 || r == -CEPHFS_ENOSPC) /* ignore ENOSPC from our callback */
1044+
if (r == 0 || r == -ENOSPC) /* ignore ENOSPC from our callback */
10451045
fuse_reply_buf(req, rc.buf, rc.pos);
10461046
else
10471047
fuse_reply_err(req, get_sys_errno(-r));
@@ -1073,7 +1073,7 @@ static void fuse_ll_access(fuse_req_t req, fuse_ino_t ino, int mask)
10731073
UserPerm perms(ctx->uid, ctx->gid);
10741074
Inode *in = cfuse->iget(ino);
10751075
if (!in) {
1076-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
1076+
fuse_reply_err(req, get_sys_errno(EINVAL));
10771077
return;
10781078
}
10791079

@@ -1094,7 +1094,7 @@ static void fuse_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name,
10941094
UserPerm perms(ctx->uid, ctx->gid);
10951095
Inode *i1 = cfuse->iget(parent), *i2;
10961096
if (!i1) {
1097-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
1097+
fuse_reply_err(req, get_sys_errno(EINVAL));
10981098
return;
10991099
}
11001100

@@ -1134,7 +1134,7 @@ static void fuse_ll_statfs(fuse_req_t req, fuse_ino_t ino)
11341134
UserPerm perms(ctx->uid, ctx->gid);
11351135
Inode *in = cfuse->iget(ino);
11361136
if (!in) {
1137-
fuse_reply_err(req, get_sys_errno(CEPHFS_EINVAL));
1137+
fuse_reply_err(req, get_sys_errno(EINVAL));
11381138
return;
11391139
}
11401140

0 commit comments

Comments
 (0)