Skip to content

Commit ae75334

Browse files
committed
Merge tag 'ceph-for-6.1-rc6' of https://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov: "Three filesystem bug fixes, intended for stable" * tag 'ceph-for-6.1-rc6' of https://github.com/ceph/ceph-client: ceph: fix NULL pointer dereference for req->r_session ceph: avoid putting the realm twice when decoding snaps fails ceph: fix a NULL vs IS_ERR() check when calling ceph_lookup_inode() MAINTAINERS: git://github.com -> https://github.com for ceph
2 parents 81ac256 + 5bd76b8 commit ae75334

File tree

4 files changed

+18
-41
lines changed

4 files changed

+18
-41
lines changed

MAINTAINERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4809,7 +4809,7 @@ R: Jeff Layton <[email protected]>
48094809
48104810
S: Supported
48114811
W: http://ceph.com/
4812-
T: git git://github.com/ceph/ceph-client.git
4812+
T: git https://github.com/ceph/ceph-client.git
48134813
F: include/linux/ceph/
48144814
F: include/linux/crush/
48154815
F: net/ceph/
@@ -4821,7 +4821,7 @@ R: Jeff Layton <[email protected]>
48214821
48224822
S: Supported
48234823
W: http://ceph.com/
4824-
T: git git://github.com/ceph/ceph-client.git
4824+
T: git https://github.com/ceph/ceph-client.git
48254825
F: Documentation/filesystems/ceph.rst
48264826
F: fs/ceph/
48274827

@@ -17222,7 +17222,7 @@ R: Dongsheng Yang <[email protected]>
1722217222
1722317223
S: Supported
1722417224
W: http://ceph.com/
17225-
T: git git://github.com/ceph/ceph-client.git
17225+
T: git https://github.com/ceph/ceph-client.git
1722617226
F: Documentation/ABI/testing/sysfs-bus-rbd
1722717227
F: drivers/block/rbd.c
1722817228
F: drivers/block/rbd_types.h

fs/ceph/caps.c

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
22482248
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
22492249
struct ceph_inode_info *ci = ceph_inode(inode);
22502250
struct ceph_mds_request *req1 = NULL, *req2 = NULL;
2251-
unsigned int max_sessions;
22522251
int ret, err = 0;
22532252

22542253
spin_lock(&ci->i_unsafe_lock);
@@ -2266,28 +2265,24 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
22662265
}
22672266
spin_unlock(&ci->i_unsafe_lock);
22682267

2269-
/*
2270-
* The mdsc->max_sessions is unlikely to be changed
2271-
* mostly, here we will retry it by reallocating the
2272-
* sessions array memory to get rid of the mdsc->mutex
2273-
* lock.
2274-
*/
2275-
retry:
2276-
max_sessions = mdsc->max_sessions;
2277-
22782268
/*
22792269
* Trigger to flush the journal logs in all the relevant MDSes
22802270
* manually, or in the worst case we must wait at most 5 seconds
22812271
* to wait the journal logs to be flushed by the MDSes periodically.
22822272
*/
2283-
if ((req1 || req2) && likely(max_sessions)) {
2284-
struct ceph_mds_session **sessions = NULL;
2285-
struct ceph_mds_session *s;
2273+
if (req1 || req2) {
22862274
struct ceph_mds_request *req;
2275+
struct ceph_mds_session **sessions;
2276+
struct ceph_mds_session *s;
2277+
unsigned int max_sessions;
22872278
int i;
22882279

2280+
mutex_lock(&mdsc->mutex);
2281+
max_sessions = mdsc->max_sessions;
2282+
22892283
sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL);
22902284
if (!sessions) {
2285+
mutex_unlock(&mdsc->mutex);
22912286
err = -ENOMEM;
22922287
goto out;
22932288
}
@@ -2299,16 +2294,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
22992294
s = req->r_session;
23002295
if (!s)
23012296
continue;
2302-
if (unlikely(s->s_mds >= max_sessions)) {
2303-
spin_unlock(&ci->i_unsafe_lock);
2304-
for (i = 0; i < max_sessions; i++) {
2305-
s = sessions[i];
2306-
if (s)
2307-
ceph_put_mds_session(s);
2308-
}
2309-
kfree(sessions);
2310-
goto retry;
2311-
}
23122297
if (!sessions[s->s_mds]) {
23132298
s = ceph_get_mds_session(s);
23142299
sessions[s->s_mds] = s;
@@ -2321,16 +2306,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
23212306
s = req->r_session;
23222307
if (!s)
23232308
continue;
2324-
if (unlikely(s->s_mds >= max_sessions)) {
2325-
spin_unlock(&ci->i_unsafe_lock);
2326-
for (i = 0; i < max_sessions; i++) {
2327-
s = sessions[i];
2328-
if (s)
2329-
ceph_put_mds_session(s);
2330-
}
2331-
kfree(sessions);
2332-
goto retry;
2333-
}
23342309
if (!sessions[s->s_mds]) {
23352310
s = ceph_get_mds_session(s);
23362311
sessions[s->s_mds] = s;
@@ -2342,11 +2317,12 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
23422317
/* the auth MDS */
23432318
spin_lock(&ci->i_ceph_lock);
23442319
if (ci->i_auth_cap) {
2345-
s = ci->i_auth_cap->session;
2346-
if (!sessions[s->s_mds])
2347-
sessions[s->s_mds] = ceph_get_mds_session(s);
2320+
s = ci->i_auth_cap->session;
2321+
if (!sessions[s->s_mds])
2322+
sessions[s->s_mds] = ceph_get_mds_session(s);
23482323
}
23492324
spin_unlock(&ci->i_ceph_lock);
2325+
mutex_unlock(&mdsc->mutex);
23502326

23512327
/* send flush mdlog request to MDSes */
23522328
for (i = 0; i < max_sessions; i++) {

fs/ceph/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
24922492
struct inode *parent;
24932493

24942494
parent = ceph_lookup_inode(sb, ceph_ino(inode));
2495-
if (!parent)
2495+
if (IS_ERR(parent))
24962496
return PTR_ERR(parent);
24972497

24982498
pci = ceph_inode(parent);

fs/ceph/snap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
763763
struct ceph_mds_snap_realm *ri; /* encoded */
764764
__le64 *snaps; /* encoded */
765765
__le64 *prior_parent_snaps; /* encoded */
766-
struct ceph_snap_realm *realm = NULL;
766+
struct ceph_snap_realm *realm;
767767
struct ceph_snap_realm *first_realm = NULL;
768768
struct ceph_snap_realm *realm_to_rebuild = NULL;
769769
int rebuild_snapcs;
@@ -774,6 +774,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
774774

775775
dout("%s deletion=%d\n", __func__, deletion);
776776
more:
777+
realm = NULL;
777778
rebuild_snapcs = 0;
778779
ceph_decode_need(&p, e, sizeof(*ri), bad);
779780
ri = p;

0 commit comments

Comments
 (0)