Skip to content

Commit bd383b8

Browse files
committed
Merge tag 'ceph-for-5.18-rc5' of https://github.com/ceph/ceph-client
Pull ceph client fixes from Ilya Dryomov: "A fix for a NULL dereference that turns out to be easily triggerable by fsync (marked for stable) and a false positive WARN and snap_rwsem locking fixups" * tag 'ceph-for-5.18-rc5' of https://github.com/ceph/ceph-client: ceph: fix possible NULL pointer dereference for req->r_session ceph: remove incorrect session state check ceph: get snap_rwsem read lock in handle_cap_export for ceph_add_cap libceph: disambiguate cluster/pool full log message
2 parents 3e71713 + 7acae61 commit bd383b8

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

fs/ceph/caps.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,6 +2274,8 @@ static int unsafe_request_wait(struct inode *inode)
22742274
list_for_each_entry(req, &ci->i_unsafe_dirops,
22752275
r_unsafe_dir_item) {
22762276
s = req->r_session;
2277+
if (!s)
2278+
continue;
22772279
if (unlikely(s->s_mds >= max_sessions)) {
22782280
spin_unlock(&ci->i_unsafe_lock);
22792281
for (i = 0; i < max_sessions; i++) {
@@ -2294,6 +2296,8 @@ static int unsafe_request_wait(struct inode *inode)
22942296
list_for_each_entry(req, &ci->i_unsafe_iops,
22952297
r_unsafe_target_item) {
22962298
s = req->r_session;
2299+
if (!s)
2300+
continue;
22972301
if (unlikely(s->s_mds >= max_sessions)) {
22982302
spin_unlock(&ci->i_unsafe_lock);
22992303
for (i = 0; i < max_sessions; i++) {
@@ -3870,6 +3874,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
38703874
dout("handle_cap_export inode %p ci %p mds%d mseq %d target %d\n",
38713875
inode, ci, mds, mseq, target);
38723876
retry:
3877+
down_read(&mdsc->snap_rwsem);
38733878
spin_lock(&ci->i_ceph_lock);
38743879
cap = __get_cap_for_mds(ci, mds);
38753880
if (!cap || cap->cap_id != le64_to_cpu(ex->cap_id))
@@ -3933,6 +3938,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
39333938
}
39343939

39353940
spin_unlock(&ci->i_ceph_lock);
3941+
up_read(&mdsc->snap_rwsem);
39363942
mutex_unlock(&session->s_mutex);
39373943

39383944
/* open target session */
@@ -3958,6 +3964,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
39583964

39593965
out_unlock:
39603966
spin_unlock(&ci->i_ceph_lock);
3967+
up_read(&mdsc->snap_rwsem);
39613968
mutex_unlock(&session->s_mutex);
39623969
if (tsession) {
39633970
mutex_unlock(&tsession->s_mutex);

fs/ceph/mds_client.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4434,8 +4434,6 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc)
44344434

44354435
bool check_session_state(struct ceph_mds_session *s)
44364436
{
4437-
struct ceph_fs_client *fsc = s->s_mdsc->fsc;
4438-
44394437
switch (s->s_state) {
44404438
case CEPH_MDS_SESSION_OPEN:
44414439
if (s->s_ttl && time_after(jiffies, s->s_ttl)) {
@@ -4444,10 +4442,6 @@ bool check_session_state(struct ceph_mds_session *s)
44444442
}
44454443
break;
44464444
case CEPH_MDS_SESSION_CLOSING:
4447-
/* Should never reach this when not force unmounting */
4448-
WARN_ON_ONCE(s->s_ttl &&
4449-
READ_ONCE(fsc->mount_state) != CEPH_MOUNT_SHUTDOWN);
4450-
fallthrough;
44514445
case CEPH_MDS_SESSION_NEW:
44524446
case CEPH_MDS_SESSION_RESTARTING:
44534447
case CEPH_MDS_SESSION_CLOSED:

net/ceph/osd_client.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,11 @@ static void __submit_request(struct ceph_osd_request *req, bool wrlocked)
23852385
if (ceph_test_opt(osdc->client, ABORT_ON_FULL)) {
23862386
err = -ENOSPC;
23872387
} else {
2388-
pr_warn_ratelimited("FULL or reached pool quota\n");
2388+
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL))
2389+
pr_warn_ratelimited("cluster is full (osdmap FULL)\n");
2390+
else
2391+
pr_warn_ratelimited("pool %lld is full or reached quota\n",
2392+
req->r_t.base_oloc.pool);
23892393
req->r_t.paused = true;
23902394
maybe_request_map(osdc);
23912395
}

0 commit comments

Comments
 (0)