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

Commit 87eeff79 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull Ceph fixes from Sage Weil:
 "We have some patches fixing up ACL support issues from Zheng and
  Guangliang and a mount option to enable/disable this support.  (These
  fixes were somewhat delayed by the Chinese holiday.)

  There is also a small fix for cached readdir handling when directories
  are fragmented"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  ceph: fix __dcache_readdir()
  ceph: add acl, noacl options for cephfs mount
  ceph: make ceph_forget_all_cached_acls() static inline
  ceph: add missing init_acl() for mkdir() and atomic_open()
  ceph: fix ceph_set_acl()
  ceph: fix ceph_removexattr()
  ceph: remove xattr when null value is given to setxattr()
  ceph: properly handle XATTR_CREATE and XATTR_REPLACE
parents 351a7934 4d5f5df6
Loading
Loading
Loading
Loading
+1 −10
Original line number Original line Diff line number Diff line
@@ -54,11 +54,6 @@ static inline struct posix_acl *ceph_get_cached_acl(struct inode *inode,
	return acl;
	return acl;
}
}


void ceph_forget_all_cached_acls(struct inode *inode)
{
	forget_all_cached_acls(inode);
}

struct posix_acl *ceph_get_acl(struct inode *inode, int type)
struct posix_acl *ceph_get_acl(struct inode *inode, int type)
{
{
	int size;
	int size;
@@ -160,11 +155,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
			goto out_dput;
			goto out_dput;
	}
	}


	if (value)
	ret = __ceph_setxattr(dentry, name, value, size, 0);
	ret = __ceph_setxattr(dentry, name, value, size, 0);
	else
		ret = __ceph_removexattr(dentry, name);

	if (ret) {
	if (ret) {
		if (new_mode != old_mode) {
		if (new_mode != old_mode) {
			newattrs.ia_mode = old_mode;
			newattrs.ia_mode = old_mode;
+17 −6
Original line number Original line Diff line number Diff line
@@ -100,6 +100,14 @@ static unsigned fpos_off(loff_t p)
	return p & 0xffffffff;
	return p & 0xffffffff;
}
}


static int fpos_cmp(loff_t l, loff_t r)
{
	int v = ceph_frag_compare(fpos_frag(l), fpos_frag(r));
	if (v)
		return v;
	return (int)(fpos_off(l) - fpos_off(r));
}

/*
/*
 * When possible, we try to satisfy a readdir by peeking at the
 * When possible, we try to satisfy a readdir by peeking at the
 * dcache.  We make this work by carefully ordering dentries on
 * dcache.  We make this work by carefully ordering dentries on
@@ -156,7 +164,7 @@ more:
		if (!d_unhashed(dentry) && dentry->d_inode &&
		if (!d_unhashed(dentry) && dentry->d_inode &&
		    ceph_snap(dentry->d_inode) != CEPH_SNAPDIR &&
		    ceph_snap(dentry->d_inode) != CEPH_SNAPDIR &&
		    ceph_ino(dentry->d_inode) != CEPH_INO_CEPH &&
		    ceph_ino(dentry->d_inode) != CEPH_INO_CEPH &&
		    ctx->pos <= di->offset)
		    fpos_cmp(ctx->pos, di->offset) <= 0)
			break;
			break;
		dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry,
		dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry,
		     dentry->d_name.len, dentry->d_name.name, di->offset,
		     dentry->d_name.len, dentry->d_name.name, di->offset,
@@ -695,9 +703,8 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry,
	ceph_mdsc_put_request(req);
	ceph_mdsc_put_request(req);


	if (!err)
	if (!err)
		err = ceph_init_acl(dentry, dentry->d_inode, dir);
		ceph_init_acl(dentry, dentry->d_inode, dir);

	else
	if (err)
		d_drop(dentry);
		d_drop(dentry);
	return err;
	return err;
}
}
@@ -735,7 +742,9 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry,
	if (!err && !req->r_reply_info.head->is_dentry)
	if (!err && !req->r_reply_info.head->is_dentry)
		err = ceph_handle_notrace_create(dir, dentry);
		err = ceph_handle_notrace_create(dir, dentry);
	ceph_mdsc_put_request(req);
	ceph_mdsc_put_request(req);
	if (err)
	if (!err)
		ceph_init_acl(dentry, dentry->d_inode, dir);
	else
		d_drop(dentry);
		d_drop(dentry);
	return err;
	return err;
}
}
@@ -776,7 +785,9 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
		err = ceph_handle_notrace_create(dir, dentry);
		err = ceph_handle_notrace_create(dir, dentry);
	ceph_mdsc_put_request(req);
	ceph_mdsc_put_request(req);
out:
out:
	if (err < 0)
	if (!err)
		ceph_init_acl(dentry, dentry->d_inode, dir);
	else
		d_drop(dentry);
		d_drop(dentry);
	return err;
	return err;
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -286,6 +286,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
	} else {
	} else {
		dout("atomic_open finish_open on dn %p\n", dn);
		dout("atomic_open finish_open on dn %p\n", dn);
		if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) {
		if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) {
			ceph_init_acl(dentry, dentry->d_inode, dir);
			*opened |= FILE_CREATED;
			*opened |= FILE_CREATED;
		}
		}
		err = finish_open(file, dentry, ceph_open, opened);
		err = finish_open(file, dentry, ceph_open, opened);
+28 −4
Original line number Original line Diff line number Diff line
@@ -144,7 +144,11 @@ enum {
	Opt_ino32,
	Opt_ino32,
	Opt_noino32,
	Opt_noino32,
	Opt_fscache,
	Opt_fscache,
	Opt_nofscache
	Opt_nofscache,
#ifdef CONFIG_CEPH_FS_POSIX_ACL
	Opt_acl,
#endif
	Opt_noacl
};
};


static match_table_t fsopt_tokens = {
static match_table_t fsopt_tokens = {
@@ -172,6 +176,10 @@ static match_table_t fsopt_tokens = {
	{Opt_noino32, "noino32"},
	{Opt_noino32, "noino32"},
	{Opt_fscache, "fsc"},
	{Opt_fscache, "fsc"},
	{Opt_nofscache, "nofsc"},
	{Opt_nofscache, "nofsc"},
#ifdef CONFIG_CEPH_FS_POSIX_ACL
	{Opt_acl, "acl"},
#endif
	{Opt_noacl, "noacl"},
	{-1, NULL}
	{-1, NULL}
};
};


@@ -271,6 +279,14 @@ static int parse_fsopt_token(char *c, void *private)
	case Opt_nofscache:
	case Opt_nofscache:
		fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
		fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
		break;
		break;
#ifdef CONFIG_CEPH_FS_POSIX_ACL
	case Opt_acl:
		fsopt->sb_flags |= MS_POSIXACL;
		break;
#endif
	case Opt_noacl:
		fsopt->sb_flags &= ~MS_POSIXACL;
		break;
	default:
	default:
		BUG_ON(token);
		BUG_ON(token);
	}
	}
@@ -438,6 +454,13 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
	else
	else
		seq_puts(m, ",nofsc");
		seq_puts(m, ",nofsc");


#ifdef CONFIG_CEPH_FS_POSIX_ACL
	if (fsopt->sb_flags & MS_POSIXACL)
		seq_puts(m, ",acl");
	else
		seq_puts(m, ",noacl");
#endif

	if (fsopt->wsize)
	if (fsopt->wsize)
		seq_printf(m, ",wsize=%d", fsopt->wsize);
		seq_printf(m, ",wsize=%d", fsopt->wsize);
	if (fsopt->rsize != CEPH_RSIZE_DEFAULT)
	if (fsopt->rsize != CEPH_RSIZE_DEFAULT)
@@ -819,9 +842,6 @@ static int ceph_set_super(struct super_block *s, void *data)


	s->s_flags = fsc->mount_options->sb_flags;
	s->s_flags = fsc->mount_options->sb_flags;
	s->s_maxbytes = 1ULL << 40;  /* temp value until we get mdsmap */
	s->s_maxbytes = 1ULL << 40;  /* temp value until we get mdsmap */
#ifdef CONFIG_CEPH_FS_POSIX_ACL
	s->s_flags |= MS_POSIXACL;
#endif


	s->s_xattr = ceph_xattr_handlers;
	s->s_xattr = ceph_xattr_handlers;
	s->s_fs_info = fsc;
	s->s_fs_info = fsc;
@@ -911,6 +931,10 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
	struct ceph_options *opt = NULL;
	struct ceph_options *opt = NULL;


	dout("ceph_mount\n");
	dout("ceph_mount\n");

#ifdef CONFIG_CEPH_FS_POSIX_ACL
	flags |= MS_POSIXACL;
#endif
	err = parse_mount_options(&fsopt, &opt, flags, data, dev_name, &path);
	err = parse_mount_options(&fsopt, &opt, flags, data, dev_name, &path);
	if (err < 0) {
	if (err < 0) {
		res = ERR_PTR(err);
		res = ERR_PTR(err);
+6 −1
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@
#include <linux/wait.h>
#include <linux/wait.h>
#include <linux/writeback.h>
#include <linux/writeback.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/posix_acl.h>


#include <linux/ceph/libceph.h>
#include <linux/ceph/libceph.h>


@@ -743,7 +744,11 @@ extern const struct xattr_handler *ceph_xattr_handlers[];
struct posix_acl *ceph_get_acl(struct inode *, int);
struct posix_acl *ceph_get_acl(struct inode *, int);
int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type);
int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type);
int ceph_init_acl(struct dentry *, struct inode *, struct inode *);
int ceph_init_acl(struct dentry *, struct inode *, struct inode *);
void ceph_forget_all_cached_acls(struct inode *inode);

static inline void ceph_forget_all_cached_acls(struct inode *inode)
{
       forget_all_cached_acls(inode);
}


#else
#else


Loading