Skip to content

Commit 4db658e

Browse files
committed
ceph: Fix up after semantic merge conflict
The previous ceph-client merge resulted in ceph not even building, because there was a merge conflict that wasn't visible as an actual data conflict: commit 7221fe4 ("ceph: add acl for cephfs") added support for POSIX ACL's into Ceph, but unluckily we also had the VFS tree change a lot of the POSIX ACL helper functions to be much more helpful to filesystems (see for example commits 2aeccbe "fs: add generic xattr_acl handlers", 5bf3258 "fs: make posix_acl_chmod more useful" and 37bc153 "fs: make posix_acl_create more useful") The reason this conflict wasn't obvious was many-fold: because it was a semantic conflict rather than a data conflict, it wasn't visible in the git merge as a conflict. And because the VFS tree hadn't been in linux-next, people hadn't become aware of it that way. And because I was at jury duty this morning, I was using my laptop and as a result not doing constant "allmodconfig" builds. Anyway, this fixes the build and generally removes a fair chunk of the Ceph POSIX ACL support code, since the improved helpers seem to match really well for Ceph too. But I don't actually have any way to *test* the end result, and I was really hoping for some ACK's for this. Oh, well. Not compiling certainly doesn't make things easier to test, so I'm committing this without the acks after having waited for four hours... Plus it's what I would have done for the merge had I noticed the semantic conflict.. Reported-by: Dave Jones <davej@redhat.com> Cc: Sage Weil <sage@inktank.com> Cc: Guangliang Zhao <lucienchao@gmail.com> Cc: Li Wang <li.wang@ubuntykylin.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d891ea2 commit 4db658e

4 files changed

Lines changed: 6 additions & 108 deletions

File tree

‎fs/ceph/acl.c‎

Lines changed: 1 addition & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir)
213213
if (ret)
214214
goto out_release;
215215
}
216-
ret = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
216+
ret = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
217217
if (ret < 0)
218218
goto out;
219219
else if (ret > 0)
@@ -229,104 +229,3 @@ int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir)
229229
out:
230230
return ret;
231231
}
232-
233-
int ceph_acl_chmod(struct dentry *dentry, struct inode *inode)
234-
{
235-
struct posix_acl *acl;
236-
int ret = 0;
237-
238-
if (S_ISLNK(inode->i_mode)) {
239-
ret = -EOPNOTSUPP;
240-
goto out;
241-
}
242-
243-
if (!IS_POSIXACL(inode))
244-
goto out;
245-
246-
acl = ceph_get_acl(inode, ACL_TYPE_ACCESS);
247-
if (IS_ERR_OR_NULL(acl)) {
248-
ret = PTR_ERR(acl);
249-
goto out;
250-
}
251-
252-
ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
253-
if (ret)
254-
goto out;
255-
ret = ceph_set_acl(dentry, inode, acl, ACL_TYPE_ACCESS);
256-
posix_acl_release(acl);
257-
out:
258-
return ret;
259-
}
260-
261-
static int ceph_xattr_acl_get(struct dentry *dentry, const char *name,
262-
void *value, size_t size, int type)
263-
{
264-
struct posix_acl *acl;
265-
int ret = 0;
266-
267-
if (!IS_POSIXACL(dentry->d_inode))
268-
return -EOPNOTSUPP;
269-
270-
acl = ceph_get_acl(dentry->d_inode, type);
271-
if (IS_ERR(acl))
272-
return PTR_ERR(acl);
273-
if (acl == NULL)
274-
return -ENODATA;
275-
276-
ret = posix_acl_to_xattr(&init_user_ns, acl, value, size);
277-
posix_acl_release(acl);
278-
279-
return ret;
280-
}
281-
282-
static int ceph_xattr_acl_set(struct dentry *dentry, const char *name,
283-
const void *value, size_t size, int flags, int type)
284-
{
285-
int ret = 0;
286-
struct posix_acl *acl = NULL;
287-
288-
if (!inode_owner_or_capable(dentry->d_inode)) {
289-
ret = -EPERM;
290-
goto out;
291-
}
292-
293-
if (!IS_POSIXACL(dentry->d_inode)) {
294-
ret = -EOPNOTSUPP;
295-
goto out;
296-
}
297-
298-
if (value) {
299-
acl = posix_acl_from_xattr(&init_user_ns, value, size);
300-
if (IS_ERR(acl)) {
301-
ret = PTR_ERR(acl);
302-
goto out;
303-
}
304-
305-
if (acl) {
306-
ret = posix_acl_valid(acl);
307-
if (ret)
308-
goto out_release;
309-
}
310-
}
311-
312-
ret = ceph_set_acl(dentry, dentry->d_inode, acl, type);
313-
314-
out_release:
315-
posix_acl_release(acl);
316-
out:
317-
return ret;
318-
}
319-
320-
const struct xattr_handler ceph_xattr_acl_default_handler = {
321-
.prefix = POSIX_ACL_XATTR_DEFAULT,
322-
.flags = ACL_TYPE_DEFAULT,
323-
.get = ceph_xattr_acl_get,
324-
.set = ceph_xattr_acl_set,
325-
};
326-
327-
const struct xattr_handler ceph_xattr_acl_access_handler = {
328-
.prefix = POSIX_ACL_XATTR_ACCESS,
329-
.flags = ACL_TYPE_ACCESS,
330-
.get = ceph_xattr_acl_get,
331-
.set = ceph_xattr_acl_set,
332-
};

‎fs/ceph/inode.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/namei.h>
1010
#include <linux/writeback.h>
1111
#include <linux/vmalloc.h>
12+
#include <linux/posix_acl.h>
1213

1314
#include "super.h"
1415
#include "mds_client.h"
@@ -1805,7 +1806,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
18051806
__mark_inode_dirty(inode, inode_dirty_flags);
18061807

18071808
if (ia_valid & ATTR_MODE) {
1808-
err = ceph_acl_chmod(dentry, inode);
1809+
err = posix_acl_chmod(inode, attr->ia_mode);
18091810
if (err)
18101811
goto out_put;
18111812
}

‎fs/ceph/super.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,15 +736,12 @@ extern void __init ceph_xattr_init(void);
736736
extern void ceph_xattr_exit(void);
737737

738738
/* acl.c */
739-
extern const struct xattr_handler ceph_xattr_acl_access_handler;
740-
extern const struct xattr_handler ceph_xattr_acl_default_handler;
741739
extern const struct xattr_handler *ceph_xattr_handlers[];
742740

743741
#ifdef CONFIG_CEPH_FS_POSIX_ACL
744742

745743
struct posix_acl *ceph_get_acl(struct inode *, int);
746744
int ceph_init_acl(struct dentry *, struct inode *, struct inode *);
747-
int ceph_acl_chmod(struct dentry *, struct inode *);
748745
void ceph_forget_all_cached_acls(struct inode *inode);
749746

750747
#else

‎fs/ceph/xattr.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/ceph/decode.h>
77

88
#include <linux/xattr.h>
9+
#include <linux/posix_acl_xattr.h>
910
#include <linux/slab.h>
1011

1112
#define XATTR_CEPH_PREFIX "ceph."
@@ -17,8 +18,8 @@
1718
*/
1819
const struct xattr_handler *ceph_xattr_handlers[] = {
1920
#ifdef CONFIG_CEPH_FS_POSIX_ACL
20-
&ceph_xattr_acl_access_handler,
21-
&ceph_xattr_acl_default_handler,
21+
&posix_acl_access_xattr_handler,
22+
&posix_acl_default_xattr_handler,
2223
#endif
2324
NULL,
2425
};

0 commit comments

Comments
 (0)