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

Commit 1a52bb0b 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: ensure prealloc_blob is in place when removing xattr
  rbd: initialize snap_rwsem in rbd_add()
  ceph: enable/disable dentry complete flags via mount option
  vfs: export symbol d_find_any_alias()
  ceph: always initialize the dentry in open_root_dentry()
  libceph: remove useless return value for osd_client __send_request()
  ceph: avoid iput() while holding spinlock in ceph_dir_fsync
  ceph: avoid useless dget/dput in encode_fh
  ceph: dereference pointer after checking for NULL
  crush: fix force for non-root TAKE
  ceph: remove unnecessary d_fsdata conditional checks
  ceph: Use kmemdup rather than duplicating its implementation

Fix up conflicts in fs/ceph/super.c (d_alloc_root() failure handling vs
always initialize the dentry in open_root_dentry)
parents 8638094e 83eb26af
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -119,12 +119,20 @@ Mount Options
	must rely on TCP's error correction to detect data corruption
	in the data payload.

  noasyncreaddir
	Disable client's use its local cache to satisfy	readdir
	requests.  (This does not change correctness; the client uses
  dcache
        Use the dcache contents to perform negative lookups and
        readdir when the client has the entire directory contents in
        its cache.  (This does not change correctness; the client uses
        cached metadata only when a lease or capability ensures it is
        valid.)

  nodcache
        Do not use the dcache as above.  This avoids a significant amount of
        complex code, sacrificing performance without affecting correctness,
        and is useful for tracking down bugs.

  noasyncreaddir
	Do not use the dcache as above for readdir.

More Information
================
+2 −0
Original line number Diff line number Diff line
@@ -2184,6 +2184,8 @@ static ssize_t rbd_add(struct bus_type *bus,
	INIT_LIST_HEAD(&rbd_dev->node);
	INIT_LIST_HEAD(&rbd_dev->snaps);

	init_rwsem(&rbd_dev->header.snap_rwsem);

	/* generate unique id: find highest unique id, add one */
	mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);

+44 −32
Original line number Diff line number Diff line
@@ -973,7 +973,7 @@ static int dentry_lease_is_valid(struct dentry *dentry)

	spin_lock(&dentry->d_lock);
	di = ceph_dentry(dentry);
	if (di && di->lease_session) {
	if (di->lease_session) {
		s = di->lease_session;
		spin_lock(&s->s_cap_lock);
		gen = s->s_cap_gen;
@@ -1072,14 +1072,12 @@ static void ceph_d_release(struct dentry *dentry)
	struct ceph_dentry_info *di = ceph_dentry(dentry);

	dout("d_release %p\n", dentry);
	if (di) {
	ceph_dentry_lru_del(dentry);
	if (di->lease_session)
		ceph_put_mds_session(di->lease_session);
	kmem_cache_free(ceph_dentry_cachep, di);
	dentry->d_fsdata = NULL;
}
}

static int ceph_snapdir_d_revalidate(struct dentry *dentry,
					  struct nameidata *nd)
@@ -1096,17 +1094,36 @@ static int ceph_snapdir_d_revalidate(struct dentry *dentry,
 */
void ceph_dir_set_complete(struct inode *inode)
{
	/* not yet implemented */
	struct dentry *dentry = d_find_any_alias(inode);
	
	if (dentry && ceph_dentry(dentry) &&
	    ceph_test_mount_opt(ceph_sb_to_client(dentry->d_sb), DCACHE)) {
		dout(" marking %p (%p) complete\n", inode, dentry);
		set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
	}
	dput(dentry);
}

void ceph_dir_clear_complete(struct inode *inode)
{
	/* not yet implemented */
	struct dentry *dentry = d_find_any_alias(inode);

	if (dentry && ceph_dentry(dentry)) {
		dout(" marking %p (%p) complete\n", inode, dentry);
		set_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
	}
	dput(dentry);
}

bool ceph_dir_test_complete(struct inode *inode)
{
	/* not yet implemented */
	struct dentry *dentry = d_find_any_alias(inode);

	if (dentry && ceph_dentry(dentry)) {
		dout(" marking %p (%p) NOT complete\n", inode, dentry);
		clear_bit(CEPH_D_COMPLETE, &ceph_dentry(dentry)->flags);
	}
	dput(dentry);
	return false;
}

@@ -1220,6 +1237,7 @@ static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end,
	do {
		ceph_mdsc_get_request(req);
		spin_unlock(&ci->i_unsafe_lock);

		dout("dir_fsync %p wait on tid %llu (until %llu)\n",
		     inode, req->r_tid, last_tid);
		if (req->r_timeout) {
@@ -1232,9 +1250,9 @@ static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end,
		} else {
			wait_for_completion(&req->r_safe_completion);
		}
		spin_lock(&ci->i_unsafe_lock);
		ceph_mdsc_put_request(req);

		spin_lock(&ci->i_unsafe_lock);
		if (ret || list_empty(head))
			break;
		req = list_entry(head->next,
@@ -1259,14 +1277,12 @@ void ceph_dentry_lru_add(struct dentry *dn)

	dout("dentry_lru_add %p %p '%.*s'\n", di, dn,
	     dn->d_name.len, dn->d_name.name);
	if (di) {
	mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
	spin_lock(&mdsc->dentry_lru_lock);
	list_add_tail(&di->lru, &mdsc->dentry_lru);
	mdsc->num_dentry++;
	spin_unlock(&mdsc->dentry_lru_lock);
}
}

void ceph_dentry_lru_touch(struct dentry *dn)
{
@@ -1275,13 +1291,11 @@ void ceph_dentry_lru_touch(struct dentry *dn)

	dout("dentry_lru_touch %p %p '%.*s' (offset %lld)\n", di, dn,
	     dn->d_name.len, dn->d_name.name, di->offset);
	if (di) {
	mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
	spin_lock(&mdsc->dentry_lru_lock);
	list_move_tail(&di->lru, &mdsc->dentry_lru);
	spin_unlock(&mdsc->dentry_lru_lock);
}
}

void ceph_dentry_lru_del(struct dentry *dn)
{
@@ -1290,14 +1304,12 @@ void ceph_dentry_lru_del(struct dentry *dn)

	dout("dentry_lru_del %p %p '%.*s'\n", di, dn,
	     dn->d_name.len, dn->d_name.name);
	if (di) {
	mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
	spin_lock(&mdsc->dentry_lru_lock);
	list_del_init(&di->lru);
	mdsc->num_dentry--;
	spin_unlock(&mdsc->dentry_lru_lock);
}
}

/*
 * Return name hash for a given dentry.  This is dependent on
+2 −4
Original line number Diff line number Diff line
@@ -56,9 +56,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
		return -EINVAL;

	spin_lock(&dentry->d_lock);
	parent = dget(dentry->d_parent);
	spin_unlock(&dentry->d_lock);

	parent = dentry->d_parent;
	if (*max_len >= connected_handle_length) {
		dout("encode_fh %p connectable\n", dentry);
		cfh->ino = ceph_ino(dentry->d_inode);
@@ -81,7 +79,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
		*max_len = handle_length;
		type = 255;
	}
	dput(parent);
	spin_unlock(&dentry->d_lock);
	return type;
}

+2 −1
Original line number Diff line number Diff line
@@ -850,11 +850,12 @@ static void ceph_set_dentry_offset(struct dentry *dn)
{
	struct dentry *dir = dn->d_parent;
	struct inode *inode = dir->d_inode;
	struct ceph_inode_info *ci = ceph_inode(inode);
	struct ceph_inode_info *ci;
	struct ceph_dentry_info *di;

	BUG_ON(!inode);

	ci = ceph_inode(inode);
	di = ceph_dentry(dn);

	spin_lock(&ci->i_ceph_lock);
Loading