Skip to content

Commit 9d0ad04

Browse files
committed
Merge tag 'ceph-for-6.13-rc1' of https://github.com/ceph/ceph-client
Pull ceph updates from Ilya Dryomov: "A fix for the mount "device" string parser from Patrick and two cred reference counting fixups from Max, marked for stable. Also included a number of cleanups and a tweak to MAINTAINERS to avoid unnecessarily CCing netdev list" * tag 'ceph-for-6.13-rc1' of https://github.com/ceph/ceph-client: ceph: fix cred leak in ceph_mds_check_access() ceph: pass cred pointer to ceph_mds_auth_match() ceph: improve caps debugging output ceph: correct ceph_mds_cap_peer field name ceph: correct ceph_mds_cap_item field name ceph: miscellaneous spelling fixes ceph: Use strscpy() instead of strcpy() in __get_snap_name() ceph: Use str_true_false() helper in status_show() ceph: requalify some char pointers as const ceph: extract entity name from device id MAINTAINERS: exclude net/ceph from networking ceph: Remove fs/ceph deadcode libceph: Remove unused ceph_crypto_key_encode libceph: Remove unused ceph_osdc_watch_check libceph: Remove unused pagevec functions libceph: Remove unused ceph_pagelist functions
2 parents baf67f6 + c5cf420 commit 9d0ad04

22 files changed

+65
-230
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16353,6 +16353,7 @@ X: include/net/wext.h
1635316353
X: net/9p/
1635416354
X: net/bluetooth/
1635516355
X: net/can/
16356+
X: net/ceph/
1635616357
X: net/mac80211/
1635716358
X: net/rfkill/
1635816359
X: net/wireless/

fs/ceph/addr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ int ceph_pool_perm_check(struct inode *inode, int need)
21952195
if (ci->i_vino.snap != CEPH_NOSNAP) {
21962196
/*
21972197
* Pool permission check needs to write to the first object.
2198-
* But for snapshot, head of the first object may have alread
2198+
* But for snapshot, head of the first object may have already
21992199
* been deleted. Skip check to avoid creating orphan object.
22002200
*/
22012201
return 0;

fs/ceph/caps.c

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -978,20 +978,6 @@ int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
978978
return 0;
979979
}
980980

981-
int ceph_caps_revoking(struct ceph_inode_info *ci, int mask)
982-
{
983-
struct inode *inode = &ci->netfs.inode;
984-
struct ceph_client *cl = ceph_inode_to_client(inode);
985-
int ret;
986-
987-
spin_lock(&ci->i_ceph_lock);
988-
ret = __ceph_caps_revoking_other(ci, NULL, mask);
989-
spin_unlock(&ci->i_ceph_lock);
990-
doutc(cl, "%p %llx.%llx %s = %d\n", inode, ceph_vinop(inode),
991-
ceph_cap_string(mask), ret);
992-
return ret;
993-
}
994-
995981
int __ceph_caps_used(struct ceph_inode_info *ci)
996982
{
997983
int used = 0;
@@ -2813,7 +2799,7 @@ void ceph_take_cap_refs(struct ceph_inode_info *ci, int got,
28132799
* requested from the MDS.
28142800
*
28152801
* Returns 0 if caps were not able to be acquired (yet), 1 if succeed,
2816-
* or a negative error code. There are 3 speical error codes:
2802+
* or a negative error code. There are 3 special error codes:
28172803
* -EAGAIN: need to sleep but non-blocking is specified
28182804
* -EFBIG: ask caller to call check_max_size() and try again.
28192805
* -EUCLEAN: ask caller to call ceph_renew_caps() and try again.
@@ -4085,23 +4071,22 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
40854071
struct ceph_cap *cap, *tcap, *new_cap = NULL;
40864072
struct ceph_inode_info *ci = ceph_inode(inode);
40874073
u64 t_cap_id;
4088-
unsigned mseq = le32_to_cpu(ex->migrate_seq);
4089-
unsigned t_seq, t_mseq;
4074+
u32 t_issue_seq, t_mseq;
40904075
int target, issued;
40914076
int mds = session->s_mds;
40924077

40934078
if (ph) {
40944079
t_cap_id = le64_to_cpu(ph->cap_id);
4095-
t_seq = le32_to_cpu(ph->seq);
4080+
t_issue_seq = le32_to_cpu(ph->issue_seq);
40964081
t_mseq = le32_to_cpu(ph->mseq);
40974082
target = le32_to_cpu(ph->mds);
40984083
} else {
4099-
t_cap_id = t_seq = t_mseq = 0;
4084+
t_cap_id = t_issue_seq = t_mseq = 0;
41004085
target = -1;
41014086
}
41024087

4103-
doutc(cl, "%p %llx.%llx ci %p mds%d mseq %d target %d\n",
4104-
inode, ceph_vinop(inode), ci, mds, mseq, target);
4088+
doutc(cl, " cap %llx.%llx export to peer %d piseq %u pmseq %u\n",
4089+
ceph_vinop(inode), target, t_issue_seq, t_mseq);
41054090
retry:
41064091
down_read(&mdsc->snap_rwsem);
41074092
spin_lock(&ci->i_ceph_lock);
@@ -4134,12 +4119,12 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
41344119
if (tcap) {
41354120
/* already have caps from the target */
41364121
if (tcap->cap_id == t_cap_id &&
4137-
ceph_seq_cmp(tcap->seq, t_seq) < 0) {
4122+
ceph_seq_cmp(tcap->seq, t_issue_seq) < 0) {
41384123
doutc(cl, " updating import cap %p mds%d\n", tcap,
41394124
target);
41404125
tcap->cap_id = t_cap_id;
4141-
tcap->seq = t_seq - 1;
4142-
tcap->issue_seq = t_seq - 1;
4126+
tcap->seq = t_issue_seq - 1;
4127+
tcap->issue_seq = t_issue_seq - 1;
41434128
tcap->issued |= issued;
41444129
tcap->implemented |= issued;
41454130
if (cap == ci->i_auth_cap) {
@@ -4154,7 +4139,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
41544139
int flag = (cap == ci->i_auth_cap) ? CEPH_CAP_FLAG_AUTH : 0;
41554140
tcap = new_cap;
41564141
ceph_add_cap(inode, tsession, t_cap_id, issued, 0,
4157-
t_seq - 1, t_mseq, (u64)-1, flag, &new_cap);
4142+
t_issue_seq - 1, t_mseq, (u64)-1, flag, &new_cap);
41584143

41594144
if (!list_empty(&ci->i_cap_flush_list) &&
41604145
ci->i_auth_cap == tcap) {
@@ -4228,18 +4213,22 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
42284213
u64 realmino = le64_to_cpu(im->realm);
42294214
u64 cap_id = le64_to_cpu(im->cap_id);
42304215
u64 p_cap_id;
4216+
u32 piseq = 0;
4217+
u32 pmseq = 0;
42314218
int peer;
42324219

42334220
if (ph) {
42344221
p_cap_id = le64_to_cpu(ph->cap_id);
42354222
peer = le32_to_cpu(ph->mds);
4223+
piseq = le32_to_cpu(ph->issue_seq);
4224+
pmseq = le32_to_cpu(ph->mseq);
42364225
} else {
42374226
p_cap_id = 0;
42384227
peer = -1;
42394228
}
42404229

4241-
doutc(cl, "%p %llx.%llx ci %p mds%d mseq %d peer %d\n",
4242-
inode, ceph_vinop(inode), ci, mds, mseq, peer);
4230+
doutc(cl, " cap %llx.%llx import from peer %d piseq %u pmseq %u\n",
4231+
ceph_vinop(inode), peer, piseq, pmseq);
42434232
retry:
42444233
cap = __get_cap_for_mds(ci, mds);
42454234
if (!cap) {
@@ -4268,15 +4257,13 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
42684257
doutc(cl, " remove export cap %p mds%d flags %d\n",
42694258
ocap, peer, ph->flags);
42704259
if ((ph->flags & CEPH_CAP_FLAG_AUTH) &&
4271-
(ocap->seq != le32_to_cpu(ph->seq) ||
4272-
ocap->mseq != le32_to_cpu(ph->mseq))) {
4260+
(ocap->seq != piseq ||
4261+
ocap->mseq != pmseq)) {
42734262
pr_err_ratelimited_client(cl, "mismatched seq/mseq: "
42744263
"%p %llx.%llx mds%d seq %d mseq %d"
42754264
" importer mds%d has peer seq %d mseq %d\n",
42764265
inode, ceph_vinop(inode), peer,
4277-
ocap->seq, ocap->mseq, mds,
4278-
le32_to_cpu(ph->seq),
4279-
le32_to_cpu(ph->mseq));
4266+
ocap->seq, ocap->mseq, mds, piseq, pmseq);
42804267
}
42814268
ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
42824269
}
@@ -4350,7 +4337,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
43504337
struct ceph_snap_realm *realm = NULL;
43514338
int op;
43524339
int msg_version = le16_to_cpu(msg->hdr.version);
4353-
u32 seq, mseq;
4340+
u32 seq, mseq, issue_seq;
43544341
struct ceph_vino vino;
43554342
void *snaptrace;
43564343
size_t snaptrace_len;
@@ -4360,8 +4347,6 @@ void ceph_handle_caps(struct ceph_mds_session *session,
43604347
bool close_sessions = false;
43614348
bool do_cap_release = false;
43624349

4363-
doutc(cl, "from mds%d\n", session->s_mds);
4364-
43654350
if (!ceph_inc_mds_stopping_blocker(mdsc, session))
43664351
return;
43674352

@@ -4375,6 +4360,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
43754360
vino.snap = CEPH_NOSNAP;
43764361
seq = le32_to_cpu(h->seq);
43774362
mseq = le32_to_cpu(h->migrate_seq);
4363+
issue_seq = le32_to_cpu(h->issue_seq);
43784364

43794365
snaptrace = h + 1;
43804366
snaptrace_len = le32_to_cpu(h->snap_trace_len);
@@ -4462,12 +4448,11 @@ void ceph_handle_caps(struct ceph_mds_session *session,
44624448

44634449
/* lookup ino */
44644450
inode = ceph_find_inode(mdsc->fsc->sb, vino);
4465-
doutc(cl, " op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op),
4466-
vino.ino, vino.snap, inode);
4451+
doutc(cl, " caps mds%d op %s ino %llx.%llx inode %p seq %u iseq %u mseq %u\n",
4452+
session->s_mds, ceph_cap_op_name(op), vino.ino, vino.snap, inode,
4453+
seq, issue_seq, mseq);
44674454

44684455
mutex_lock(&session->s_mutex);
4469-
doutc(cl, " mds%d seq %lld cap seq %u\n", session->s_mds,
4470-
session->s_seq, (unsigned)seq);
44714456

44724457
if (!inode) {
44734458
doutc(cl, " i don't have ino %llx\n", vino.ino);

fs/ceph/crypto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct ceph_fname {
2727
};
2828

2929
/*
30-
* Header for the crypted file when truncating the size, this
30+
* Header for the encrypted file when truncating the size, this
3131
* will be sent to MDS, and the MDS will update the encrypted
3232
* last block and then truncate the size.
3333
*/

fs/ceph/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static int status_show(struct seq_file *s, void *p)
357357

358358
seq_printf(s, "instance: %s.%lld %s/%u\n", ENTITY_NAME(inst->name),
359359
ceph_pr_addr(client_addr), le32_to_cpu(client_addr->nonce));
360-
seq_printf(s, "blocklisted: %s\n", fsc->blocklisted ? "true" : "false");
360+
seq_printf(s, "blocklisted: %s\n", str_true_false(fsc->blocklisted));
361361

362362
return 0;
363363
}

fs/ceph/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,
207207
dentry = __dcache_find_get_entry(parent, idx + step,
208208
&cache_ctl);
209209
if (!dentry) {
210-
/* use linar search */
210+
/* use linear search */
211211
idx = 0;
212212
break;
213213
}
@@ -659,7 +659,7 @@ static bool need_reset_readdir(struct ceph_dir_file_info *dfi, loff_t new_pos)
659659
return true;
660660
if (is_hash_order(new_pos)) {
661661
/* no need to reset last_name for a forward seek when
662-
* dentries are sotred in hash order */
662+
* dentries are sorted in hash order */
663663
} else if (dfi->frag != fpos_frag(new_pos)) {
664664
return true;
665665
}

fs/ceph/export.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ static struct dentry *ceph_get_parent(struct dentry *child)
393393
}
394394
dir = snapdir;
395395
}
396-
/* If directory has already been deleted, futher get_parent
396+
/* If directory has already been deleted, further get_parent
397397
* will fail. Do not mark snapdir dentry as disconnected,
398-
* this prevent exportfs from doing futher get_parent. */
398+
* this prevents exportfs from doing further get_parent. */
399399
if (unlinked)
400400
dn = d_obtain_root(dir);
401401
else
@@ -452,7 +452,13 @@ static int __get_snap_name(struct dentry *parent, char *name,
452452
goto out;
453453
if (ceph_snap(inode) == CEPH_SNAPDIR) {
454454
if (ceph_snap(dir) == CEPH_NOSNAP) {
455-
strcpy(name, fsc->mount_options->snapdir_name);
455+
/*
456+
* .get_name() from struct export_operations
457+
* assumes that its 'name' parameter is pointing
458+
* to a NAME_MAX+1 sized buffer
459+
*/
460+
strscpy(name, fsc->mount_options->snapdir_name,
461+
NAME_MAX + 1);
456462
err = 0;
457463
}
458464
goto out;

fs/ceph/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino,
160160
}
161161

162162
/*
163-
* get/constuct snapdir inode for a given directory
163+
* get/construct snapdir inode for a given directory
164164
*/
165165
struct inode *ceph_get_snapdir(struct inode *parent)
166166
{

fs/ceph/mds_client.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ static void destroy_reply_info(struct ceph_mds_reply_info_parsed *info)
827827
* And the worst case is that for the none async openc request it will
828828
* successfully open the file if the CDentry hasn't been unlinked yet,
829829
* but later the previous delayed async unlink request will remove the
830-
* CDenty. That means the just created file is possiblly deleted later
830+
* CDentry. That means the just created file is possibly deleted later
831831
* by accident.
832832
*
833833
* We need to wait for the inflight async unlink requests to finish
@@ -1747,14 +1747,6 @@ static void __open_export_target_sessions(struct ceph_mds_client *mdsc,
17471747
}
17481748
}
17491749

1750-
void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
1751-
struct ceph_mds_session *session)
1752-
{
1753-
mutex_lock(&mdsc->mutex);
1754-
__open_export_target_sessions(mdsc, session);
1755-
mutex_unlock(&mdsc->mutex);
1756-
}
1757-
17581750
/*
17591751
* session caps
17601752
*/
@@ -2362,7 +2354,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
23622354
item->ino = cpu_to_le64(cap->cap_ino);
23632355
item->cap_id = cpu_to_le64(cap->cap_id);
23642356
item->migrate_seq = cpu_to_le32(cap->mseq);
2365-
item->seq = cpu_to_le32(cap->issue_seq);
2357+
item->issue_seq = cpu_to_le32(cap->issue_seq);
23662358
msg->front.iov_len += sizeof(*item);
23672359

23682360
ceph_put_cap(mdsc, cap);
@@ -3269,7 +3261,7 @@ static int __prepare_send_request(struct ceph_mds_session *session,
32693261
&session->s_features);
32703262

32713263
/*
3272-
* Avoid inifinite retrying after overflow. The client will
3264+
* Avoid infinite retrying after overflow. The client will
32733265
* increase the retry count and if the MDS is old version,
32743266
* so we limit to retry at most 256 times.
32753267
*/
@@ -3522,7 +3514,7 @@ static void __do_request(struct ceph_mds_client *mdsc,
35223514

35233515
/*
35243516
* For async create we will choose the auth MDS of frag in parent
3525-
* directory to send the request and ususally this works fine, but
3517+
* directory to send the request and usually this works fine, but
35263518
* if the migrated the dirtory to another MDS before it could handle
35273519
* it the request will be forwarded.
35283520
*
@@ -4033,7 +4025,7 @@ static void handle_forward(struct ceph_mds_client *mdsc,
40334025
__unregister_request(mdsc, req);
40344026
} else if (fwd_seq <= req->r_num_fwd || (uint32_t)fwd_seq >= U32_MAX) {
40354027
/*
4036-
* Avoid inifinite retrying after overflow.
4028+
* Avoid infinite retrying after overflow.
40374029
*
40384030
* The MDS will increase the fwd count and in client side
40394031
* if the num_fwd is less than the one saved in request
@@ -5609,9 +5601,9 @@ void send_flush_mdlog(struct ceph_mds_session *s)
56095601

56105602
static int ceph_mds_auth_match(struct ceph_mds_client *mdsc,
56115603
struct ceph_mds_cap_auth *auth,
5604+
const struct cred *cred,
56125605
char *tpath)
56135606
{
5614-
const struct cred *cred = get_current_cred();
56155607
u32 caller_uid = from_kuid(&init_user_ns, cred->fsuid);
56165608
u32 caller_gid = from_kgid(&init_user_ns, cred->fsgid);
56175609
struct ceph_client *cl = mdsc->fsc->client;
@@ -5734,11 +5726,12 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
57345726
for (i = 0; i < mdsc->s_cap_auths_num; i++) {
57355727
struct ceph_mds_cap_auth *s = &mdsc->s_cap_auths[i];
57365728

5737-
err = ceph_mds_auth_match(mdsc, s, tpath);
5729+
err = ceph_mds_auth_match(mdsc, s, cred, tpath);
57385730
if (err < 0) {
5731+
put_cred(cred);
57395732
return err;
57405733
} else if (err > 0) {
5741-
/* always follow the last auth caps' permision */
5734+
/* always follow the last auth caps' permission */
57425735
root_squash_perms = true;
57435736
rw_perms_s = NULL;
57445737
if ((mask & MAY_WRITE) && s->writeable &&
@@ -5751,6 +5744,8 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)
57515744
}
57525745
}
57535746

5747+
put_cred(cred);
5748+
57545749
doutc(cl, "root_squash_perms %d, rw_perms_s %p\n", root_squash_perms,
57555750
rw_perms_s);
57565751
if (root_squash_perms && rw_perms_s == NULL) {

fs/ceph/mds_client.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,6 @@ extern void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc,
634634

635635
extern struct ceph_mds_session *
636636
ceph_mdsc_open_export_target_session(struct ceph_mds_client *mdsc, int target);
637-
extern void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
638-
struct ceph_mds_session *session);
639637

640638
extern int ceph_trim_caps(struct ceph_mds_client *mdsc,
641639
struct ceph_mds_session *session,

0 commit comments

Comments
 (0)