Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b12ece7d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  ceph: avoid picking MDS that is not active
  ceph: avoid immediate cap check after import
  ceph: fix flushing of caps vs cap import
  ceph: fix erroneous cap flush to non-auth mds
  ceph: fix cap_wanted_delay_{min,max} mount option initialization
  ceph: fix xattr rbtree search
  ceph: fix getattr on directory when using norbytes
parents 363aab29 d66bbd44
Loading
Loading
Loading
Loading
+37 −6
Original line number Original line Diff line number Diff line
@@ -1560,8 +1560,9 @@ retry_locked:
		/* NOTE: no side-effects allowed, until we take s_mutex */
		/* NOTE: no side-effects allowed, until we take s_mutex */


		revoking = cap->implemented & ~cap->issued;
		revoking = cap->implemented & ~cap->issued;
		if (revoking)
		dout(" mds%d cap %p issued %s implemented %s revoking %s\n",
			dout(" mds%d revoking %s\n", cap->mds,
		     cap->mds, cap, ceph_cap_string(cap->issued),
		     ceph_cap_string(cap->implemented),
		     ceph_cap_string(revoking));
		     ceph_cap_string(revoking));


		if (cap == ci->i_auth_cap &&
		if (cap == ci->i_auth_cap &&
@@ -1658,6 +1659,8 @@ ack:


		if (cap == ci->i_auth_cap && ci->i_dirty_caps)
		if (cap == ci->i_auth_cap && ci->i_dirty_caps)
			flushing = __mark_caps_flushing(inode, session);
			flushing = __mark_caps_flushing(inode, session);
		else
			flushing = 0;


		mds = cap->mds;  /* remember mds, so we don't repeat */
		mds = cap->mds;  /* remember mds, so we don't repeat */
		sent++;
		sent++;
@@ -1940,6 +1943,35 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,
	}
	}
}
}


static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc,
				     struct ceph_mds_session *session,
				     struct inode *inode)
{
	struct ceph_inode_info *ci = ceph_inode(inode);
	struct ceph_cap *cap;
	int delayed = 0;

	spin_lock(&inode->i_lock);
	cap = ci->i_auth_cap;
	dout("kick_flushing_inode_caps %p flushing %s flush_seq %lld\n", inode,
	     ceph_cap_string(ci->i_flushing_caps), ci->i_cap_flush_seq);
	__ceph_flush_snaps(ci, &session, 1);
	if (ci->i_flushing_caps) {
		delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH,
				     __ceph_caps_used(ci),
				     __ceph_caps_wanted(ci),
				     cap->issued | cap->implemented,
				     ci->i_flushing_caps, NULL);
		if (delayed) {
			spin_lock(&inode->i_lock);
			__cap_delay_requeue(mdsc, ci);
			spin_unlock(&inode->i_lock);
		}
	} else {
		spin_unlock(&inode->i_lock);
	}
}



/*
/*
 * Take references to capabilities we hold, so that we don't release
 * Take references to capabilities we hold, so that we don't release
@@ -2687,7 +2719,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
	ceph_add_cap(inode, session, cap_id, -1,
	ceph_add_cap(inode, session, cap_id, -1,
		     issued, wanted, seq, mseq, realmino, CEPH_CAP_FLAG_AUTH,
		     issued, wanted, seq, mseq, realmino, CEPH_CAP_FLAG_AUTH,
		     NULL /* no caps context */);
		     NULL /* no caps context */);
	try_flush_caps(inode, session, NULL);
	kick_flushing_inode_caps(mdsc, session, inode);
	up_read(&mdsc->snap_rwsem);
	up_read(&mdsc->snap_rwsem);


	/* make sure we re-request max_size, if necessary */
	/* make sure we re-request max_size, if necessary */
@@ -2785,8 +2817,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
	case CEPH_CAP_OP_IMPORT:
	case CEPH_CAP_OP_IMPORT:
		handle_cap_import(mdsc, inode, h, session,
		handle_cap_import(mdsc, inode, h, session,
				  snaptrace, snaptrace_len);
				  snaptrace, snaptrace_len);
		ceph_check_caps(ceph_inode(inode), CHECK_CAPS_NODELAY,
		ceph_check_caps(ceph_inode(inode), 0, session);
				session);
		goto done_unlocked;
		goto done_unlocked;
	}
	}


+5 −5
Original line number Original line Diff line number Diff line
@@ -710,10 +710,6 @@ static int fill_inode(struct inode *inode,
			ci->i_ceph_flags |= CEPH_I_COMPLETE;
			ci->i_ceph_flags |= CEPH_I_COMPLETE;
			ci->i_max_offset = 2;
			ci->i_max_offset = 2;
		}
		}

		/* it may be better to set st_size in getattr instead? */
		if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), RBYTES))
			inode->i_size = ci->i_rbytes;
		break;
		break;
	default:
	default:
		pr_err("fill_inode %llx.%llx BAD mode 0%o\n",
		pr_err("fill_inode %llx.%llx BAD mode 0%o\n",
@@ -1819,7 +1815,11 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
		else
		else
			stat->dev = 0;
			stat->dev = 0;
		if (S_ISDIR(inode->i_mode)) {
		if (S_ISDIR(inode->i_mode)) {
			if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
						RBYTES))
				stat->size = ci->i_rbytes;
				stat->size = ci->i_rbytes;
			else
				stat->size = ci->i_files + ci->i_subdirs;
			stat->blocks = 0;
			stat->blocks = 0;
			stat->blksize = 65536;
			stat->blksize = 65536;
		}
		}
+7 −3
Original line number Original line Diff line number Diff line
@@ -693,8 +693,10 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
				dout("choose_mds %p %llx.%llx "
				dout("choose_mds %p %llx.%llx "
				     "frag %u mds%d (%d/%d)\n",
				     "frag %u mds%d (%d/%d)\n",
				     inode, ceph_vinop(inode),
				     inode, ceph_vinop(inode),
				     frag.frag, frag.mds,
				     frag.frag, mds,
				     (int)r, frag.ndist);
				     (int)r, frag.ndist);
				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
				    CEPH_MDS_STATE_ACTIVE)
					return mds;
					return mds;
			}
			}


@@ -708,6 +710,8 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
				dout("choose_mds %p %llx.%llx "
				dout("choose_mds %p %llx.%llx "
				     "frag %u mds%d (auth)\n",
				     "frag %u mds%d (auth)\n",
				     inode, ceph_vinop(inode), frag.frag, mds);
				     inode, ceph_vinop(inode), frag.frag, mds);
				if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
				    CEPH_MDS_STATE_ACTIVE)
					return mds;
					return mds;
			}
			}
		}
		}
+2 −0
Original line number Original line Diff line number Diff line
@@ -290,6 +290,8 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt,


        fsopt->rsize = CEPH_MOUNT_RSIZE_DEFAULT;
        fsopt->rsize = CEPH_MOUNT_RSIZE_DEFAULT;
        fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
        fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
	fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT;
	fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT;
        fsopt->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT;
        fsopt->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT;
        fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
        fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
        fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
        fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
+3 −0
Original line number Original line Diff line number Diff line
@@ -219,6 +219,7 @@ static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci,
	struct rb_node **p;
	struct rb_node **p;
	struct rb_node *parent = NULL;
	struct rb_node *parent = NULL;
	struct ceph_inode_xattr *xattr = NULL;
	struct ceph_inode_xattr *xattr = NULL;
	int name_len = strlen(name);
	int c;
	int c;


	p = &ci->i_xattrs.index.rb_node;
	p = &ci->i_xattrs.index.rb_node;
@@ -226,6 +227,8 @@ static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci,
		parent = *p;
		parent = *p;
		xattr = rb_entry(parent, struct ceph_inode_xattr, node);
		xattr = rb_entry(parent, struct ceph_inode_xattr, node);
		c = strncmp(name, xattr->name, xattr->name_len);
		c = strncmp(name, xattr->name, xattr->name_len);
		if (c == 0 && name_len > xattr->name_len)
			c = 1;
		if (c < 0)
		if (c < 0)
			p = &(*p)->rb_left;
			p = &(*p)->rb_left;
		else if (c > 0)
		else if (c > 0)