Commit ae753340 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -4809,7 +4809,7 @@ R: Jeff Layton <jlayton@kernel.org>
L:	ceph-devel@vger.kernel.org
S:	Supported
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/crush/
F:	net/ceph/
@@ -4821,7 +4821,7 @@ R: Jeff Layton <jlayton@kernel.org>
L:	ceph-devel@vger.kernel.org
S:	Supported
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:	fs/ceph/
@@ -17222,7 +17222,7 @@ R: Dongsheng Yang <dongsheng.yang@easystack.cn>
L:	ceph-devel@vger.kernel.org
S:	Supported
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:	drivers/block/rbd.c
F:	drivers/block/rbd_types.h
+12 −36
Original line number Diff line number Diff line
@@ -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_inode_info *ci = ceph_inode(inode);
	struct ceph_mds_request *req1 = NULL, *req2 = NULL;
	unsigned int max_sessions;
	int ret, err = 0;

	spin_lock(&ci->i_unsafe_lock);
@@ -2266,28 +2265,24 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
	}
	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
	 * 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.
	 */
	if ((req1 || req2) && likely(max_sessions)) {
		struct ceph_mds_session **sessions = NULL;
		struct ceph_mds_session *s;
	if (req1 || req2) {
		struct ceph_mds_request *req;
		struct ceph_mds_session **sessions;
		struct ceph_mds_session *s;
		unsigned int max_sessions;
		int i;

		mutex_lock(&mdsc->mutex);
		max_sessions = mdsc->max_sessions;

		sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL);
		if (!sessions) {
			mutex_unlock(&mdsc->mutex);
			err = -ENOMEM;
			goto out;
		}
@@ -2299,16 +2294,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
				s = req->r_session;
				if (!s)
					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]) {
					s = ceph_get_mds_session(s);
					sessions[s->s_mds] = s;
@@ -2321,16 +2306,6 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
				s = req->r_session;
				if (!s)
					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]) {
					s = ceph_get_mds_session(s);
					sessions[s->s_mds] = s;
@@ -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);
		}
		spin_unlock(&ci->i_ceph_lock);
		mutex_unlock(&mdsc->mutex);

		/* send flush mdlog request to MDSes */
		for (i = 0; i < max_sessions; i++) {
+1 −1
Original line number Diff line number Diff line
@@ -2492,7 +2492,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
			struct inode *parent;

			parent = ceph_lookup_inode(sb, ceph_ino(inode));
			if (!parent)
			if (IS_ERR(parent))
				return PTR_ERR(parent);

			pci = ceph_inode(parent);
+2 −1
Original line number Diff line number Diff line
@@ -763,7 +763,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
	struct ceph_mds_snap_realm *ri;    /* encoded */
	__le64 *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 *realm_to_rebuild = NULL;
	int rebuild_snapcs;
@@ -774,6 +774,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,

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