Commit ae753340 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 81ac2565 5bd76b8d
...@@ -4809,7 +4809,7 @@ R: Jeff Layton <jlayton@kernel.org> ...@@ -4809,7 +4809,7 @@ R: Jeff Layton <jlayton@kernel.org>
L: ceph-devel@vger.kernel.org L: ceph-devel@vger.kernel.org
S: Supported S: Supported
W: http://ceph.com/ W: http://ceph.com/
T: git git://github.com/ceph/ceph-client.git T: git https://github.com/ceph/ceph-client.git
F: include/linux/ceph/ F: include/linux/ceph/
F: include/linux/crush/ F: include/linux/crush/
F: net/ceph/ F: net/ceph/
...@@ -4821,7 +4821,7 @@ R: Jeff Layton <jlayton@kernel.org> ...@@ -4821,7 +4821,7 @@ R: Jeff Layton <jlayton@kernel.org>
L: ceph-devel@vger.kernel.org L: ceph-devel@vger.kernel.org
S: Supported S: Supported
W: http://ceph.com/ W: http://ceph.com/
T: git git://github.com/ceph/ceph-client.git T: git https://github.com/ceph/ceph-client.git
F: Documentation/filesystems/ceph.rst F: Documentation/filesystems/ceph.rst
F: fs/ceph/ F: fs/ceph/
...@@ -17222,7 +17222,7 @@ R: Dongsheng Yang <dongsheng.yang@easystack.cn> ...@@ -17222,7 +17222,7 @@ R: Dongsheng Yang <dongsheng.yang@easystack.cn>
L: ceph-devel@vger.kernel.org L: ceph-devel@vger.kernel.org
S: Supported S: Supported
W: http://ceph.com/ W: http://ceph.com/
T: git git://github.com/ceph/ceph-client.git T: git https://github.com/ceph/ceph-client.git
F: Documentation/ABI/testing/sysfs-bus-rbd F: Documentation/ABI/testing/sysfs-bus-rbd
F: drivers/block/rbd.c F: drivers/block/rbd.c
F: drivers/block/rbd_types.h F: drivers/block/rbd_types.h
......
...@@ -2248,7 +2248,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode) ...@@ -2248,7 +2248,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
struct ceph_mds_request *req1 = NULL, *req2 = NULL; struct ceph_mds_request *req1 = NULL, *req2 = NULL;
unsigned int max_sessions;
int ret, err = 0; int ret, err = 0;
spin_lock(&ci->i_unsafe_lock); spin_lock(&ci->i_unsafe_lock);
...@@ -2266,28 +2265,24 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode) ...@@ -2266,28 +2265,24 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
} }
spin_unlock(&ci->i_unsafe_lock); spin_unlock(&ci->i_unsafe_lock);
/*
* The mdsc->max_sessions is unlikely to be changed
* mostly, here we will retry it by reallocating the
* sessions array memory to get rid of the mdsc->mutex
* lock.
*/
retry:
max_sessions = mdsc->max_sessions;
/* /*
* Trigger to flush the journal logs in all the relevant MDSes * Trigger to flush the journal logs in all the relevant MDSes
* manually, or in the worst case we must wait at most 5 seconds * manually, or in the worst case we must wait at most 5 seconds
* to wait the journal logs to be flushed by the MDSes periodically. * to wait the journal logs to be flushed by the MDSes periodically.
*/ */
if ((req1 || req2) && likely(max_sessions)) { if (req1 || req2) {
struct ceph_mds_session **sessions = NULL;
struct ceph_mds_session *s;
struct ceph_mds_request *req; struct ceph_mds_request *req;
struct ceph_mds_session **sessions;
struct ceph_mds_session *s;
unsigned int max_sessions;
int i; int i;
mutex_lock(&mdsc->mutex);
max_sessions = mdsc->max_sessions;
sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL); sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL);
if (!sessions) { if (!sessions) {
mutex_unlock(&mdsc->mutex);
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
...@@ -2299,16 +2294,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode) ...@@ -2299,16 +2294,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
s = req->r_session; s = req->r_session;
if (!s) if (!s)
continue; continue;
if (unlikely(s->s_mds >= max_sessions)) {
spin_unlock(&ci->i_unsafe_lock);
for (i = 0; i < max_sessions; i++) {
s = sessions[i];
if (s)
ceph_put_mds_session(s);
}
kfree(sessions);
goto retry;
}
if (!sessions[s->s_mds]) { if (!sessions[s->s_mds]) {
s = ceph_get_mds_session(s); s = ceph_get_mds_session(s);
sessions[s->s_mds] = s; sessions[s->s_mds] = s;
...@@ -2321,16 +2306,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode) ...@@ -2321,16 +2306,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
s = req->r_session; s = req->r_session;
if (!s) if (!s)
continue; continue;
if (unlikely(s->s_mds >= max_sessions)) {
spin_unlock(&ci->i_unsafe_lock);
for (i = 0; i < max_sessions; i++) {
s = sessions[i];
if (s)
ceph_put_mds_session(s);
}
kfree(sessions);
goto retry;
}
if (!sessions[s->s_mds]) { if (!sessions[s->s_mds]) {
s = ceph_get_mds_session(s); s = ceph_get_mds_session(s);
sessions[s->s_mds] = s; sessions[s->s_mds] = s;
...@@ -2347,6 +2322,7 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode) ...@@ -2347,6 +2322,7 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
sessions[s->s_mds] = ceph_get_mds_session(s); sessions[s->s_mds] = ceph_get_mds_session(s);
} }
spin_unlock(&ci->i_ceph_lock); spin_unlock(&ci->i_ceph_lock);
mutex_unlock(&mdsc->mutex);
/* send flush mdlog request to MDSes */ /* send flush mdlog request to MDSes */
for (i = 0; i < max_sessions; i++) { for (i = 0; i < max_sessions; i++) {
......
...@@ -2492,7 +2492,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path, ...@@ -2492,7 +2492,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
struct inode *parent; struct inode *parent;
parent = ceph_lookup_inode(sb, ceph_ino(inode)); parent = ceph_lookup_inode(sb, ceph_ino(inode));
if (!parent) if (IS_ERR(parent))
return PTR_ERR(parent); return PTR_ERR(parent);
pci = ceph_inode(parent); pci = ceph_inode(parent);
......
...@@ -763,7 +763,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc, ...@@ -763,7 +763,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
struct ceph_mds_snap_realm *ri; /* encoded */ struct ceph_mds_snap_realm *ri; /* encoded */
__le64 *snaps; /* encoded */ __le64 *snaps; /* encoded */
__le64 *prior_parent_snaps; /* encoded */ __le64 *prior_parent_snaps; /* encoded */
struct ceph_snap_realm *realm = NULL; struct ceph_snap_realm *realm;
struct ceph_snap_realm *first_realm = NULL; struct ceph_snap_realm *first_realm = NULL;
struct ceph_snap_realm *realm_to_rebuild = NULL; struct ceph_snap_realm *realm_to_rebuild = NULL;
int rebuild_snapcs; int rebuild_snapcs;
...@@ -774,6 +774,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc, ...@@ -774,6 +774,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
dout("%s deletion=%d\n", __func__, deletion); dout("%s deletion=%d\n", __func__, deletion);
more: more:
realm = NULL;
rebuild_snapcs = 0; rebuild_snapcs = 0;
ceph_decode_need(&p, e, sizeof(*ri), bad); ceph_decode_need(&p, e, sizeof(*ri), bad);
ri = p; ri = p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment