Commit 524d0c68 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'ceph-for-6.1-rc1' of https://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:
 "A quiet round this time: several assorted filesystem fixes, the most
  noteworthy one being some additional wakeups in cap handling code, and
  a messenger cleanup"

* tag 'ceph-for-6.1-rc1' of https://github.com/ceph/ceph-client:
  ceph: remove Sage's git tree from documentation
  ceph: fix incorrectly showing the .snap size for stat
  ceph: fail the open_by_handle_at() if the dentry is being unlinked
  ceph: increment i_version when doing a setattr with caps
  ceph: Use kcalloc for allocating multiple elements
  ceph: no need to wait for transition RDCACHE|RD -> RD
  ceph: fail the request if the peer MDS doesn't support getvxattr op
  ceph: wake up the waiters if any new caps comes
  libceph: drop last_piece flag from ceph_msg_data_cursor
parents 66b83455 71cf0c1c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -203,7 +203,6 @@ For more information on Ceph, see the home page at

The Linux kernel client source tree is available at
	- https://github.com/ceph/ceph-client.git
	- git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git

and the source for the full system is at
	https://github.com/ceph/ceph.git
+11 −3
Original line number Diff line number Diff line
@@ -754,6 +754,7 @@ void ceph_add_cap(struct inode *inode,
	cap->issue_seq = seq;
	cap->mseq = mseq;
	cap->cap_gen = gen;
	wake_up_all(&ci->i_cap_wq);
}

/*
@@ -2285,7 +2286,7 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
		struct ceph_mds_request *req;
		int i;

		sessions = kzalloc(max_sessions * sizeof(s), GFP_KERNEL);
		sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL);
		if (!sessions) {
			err = -ENOMEM;
			goto out;
@@ -2759,13 +2760,17 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
		 * on transition from wanted -> needed caps.  This is needed
		 * for WRBUFFER|WR -> WR to avoid a new WR sync write from
		 * going before a prior buffered writeback happens.
		 *
		 * For RDCACHE|RD -> RD, there is not need to wait and we can
		 * just exclude the revoking caps and force to sync read.
		 */
		int not = want & ~(have & need);
		int revoking = implemented & ~have;
		int exclude = revoking & not;
		dout("get_cap_refs %p have %s but not %s (revoking %s)\n",
		     inode, ceph_cap_string(have), ceph_cap_string(not),
		     ceph_cap_string(revoking));
		if ((revoking & not) == 0) {
		if (!exclude || !(exclude & CEPH_CAP_FILE_BUFFER)) {
			if (!snap_rwsem_locked &&
			    !ci->i_head_snapc &&
			    (need & CEPH_CAP_FILE_WR)) {
@@ -2787,7 +2792,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
				snap_rwsem_locked = true;
			}
			if ((have & want) == want)
				*got = need | want;
				*got = need | (want & ~exclude);
			else
				*got = need;
			ceph_take_cap_refs(ci, *got, true);
@@ -3550,6 +3555,9 @@ static void handle_cap_grant(struct inode *inode,
			check_caps = 1; /* check auth cap only */
		else
			check_caps = 2; /* check all caps */
		/* If there is new caps, try to wake up the waiters */
		if (~cap->issued & newcaps)
			wake = true;
		cap->issued = newcaps;
		cap->implemented |= newcaps;
	} else if (cap->issued == newcaps) {
+2 −1
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino)
static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
{
	struct inode *inode = __lookup_inode(sb, ino);
	struct ceph_inode_info *ci = ceph_inode(inode);
	int err;

	if (IS_ERR(inode))
@@ -192,7 +193,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
		return ERR_PTR(err);
	}
	/* -ESTALE if inode as been unlinked and no file is open */
	if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) {
	if ((inode->i_nlink == 0) && !__ceph_is_file_opened(ci)) {
		iput(inode);
		return ERR_PTR(-ESTALE);
	}
+25 −4
Original line number Diff line number Diff line
@@ -2192,6 +2192,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
		inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
							   &prealloc_cf);
		inode->i_ctime = attr->ia_ctime;
		inode_inc_iversion_raw(inode);
	}

	release &= issued;
@@ -2356,6 +2357,7 @@ int ceph_do_getvxattr(struct inode *inode, const char *name, void *value,
		goto out;
	}

	req->r_feature_needed = CEPHFS_FEATURE_OP_GETVXATTR;
	req->r_path2 = kstrdup(name, GFP_NOFS);
	if (!req->r_path2) {
		err = -ENOMEM;
@@ -2447,6 +2449,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
		 struct kstat *stat, u32 request_mask, unsigned int flags)
{
	struct inode *inode = d_inode(path->dentry);
	struct super_block *sb = inode->i_sb;
	struct ceph_inode_info *ci = ceph_inode(inode);
	u32 valid_mask = STATX_BASIC_STATS;
	int err = 0;
@@ -2476,16 +2479,34 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
	}

	if (ceph_snap(inode) == CEPH_NOSNAP)
		stat->dev = inode->i_sb->s_dev;
		stat->dev = sb->s_dev;
	else
		stat->dev = ci->i_snapid_map ? ci->i_snapid_map->dev : 0;

	if (S_ISDIR(inode->i_mode)) {
		if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
					RBYTES))
		if (ceph_test_mount_opt(ceph_sb_to_client(sb), RBYTES)) {
			stat->size = ci->i_rbytes;
		} else if (ceph_snap(inode) == CEPH_SNAPDIR) {
			struct ceph_inode_info *pci;
			struct ceph_snap_realm *realm;
			struct inode *parent;

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

			pci = ceph_inode(parent);
			spin_lock(&pci->i_ceph_lock);
			realm = pci->i_snap_realm;
			if (realm)
				stat->size = realm->num_snaps;
			else
				stat->size = 0;
			spin_unlock(&pci->i_ceph_lock);
			iput(parent);
		} else {
			stat->size = ci->i_files + ci->i_subdirs;
		}
		stat->blocks = 0;
		stat->blksize = 65536;
		/*
+11 −0
Original line number Diff line number Diff line
@@ -2318,6 +2318,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
	INIT_LIST_HEAD(&req->r_unsafe_dir_item);
	INIT_LIST_HEAD(&req->r_unsafe_target_item);
	req->r_fmode = -1;
	req->r_feature_needed = -1;
	kref_init(&req->r_kref);
	RB_CLEAR_NODE(&req->r_node);
	INIT_LIST_HEAD(&req->r_wait);
@@ -2916,6 +2917,16 @@ static void __do_request(struct ceph_mds_client *mdsc,

	dout("do_request mds%d session %p state %s\n", mds, session,
	     ceph_session_state_name(session->s_state));

	/*
	 * The old ceph will crash the MDSs when see unknown OPs
	 */
	if (req->r_feature_needed > 0 &&
	    !test_bit(req->r_feature_needed, &session->s_features)) {
		err = -EOPNOTSUPP;
		goto out_session;
	}

	if (session->s_state != CEPH_MDS_SESSION_OPEN &&
	    session->s_state != CEPH_MDS_SESSION_HUNG) {
		/*
Loading