From bf9965d82268062bfb47817b1a06e2c59f43662f Mon Sep 17 00:00:00 2001 From: fanyong Date: Mon, 30 Oct 2006 02:31:53 +0000 Subject: [PATCH] Local client should not use "lfs getfacl / lfs setfacl". --- lustre/llite/llite_lib.c | 10 ++++++++-- lustre/utils/liblustreapi.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 99f9a34..d5928d9 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2279,6 +2279,7 @@ void ll_finish_md_op_data(struct md_op_data *op_data) int ll_ioctl_getfacl(struct inode *inode, struct rmtacl_ioctl_data *ioc) { + struct ll_sb_info *sbi = ll_i2sbi(inode); struct ptlrpc_request *req = NULL; struct mdt_body *body; char *cmd, *buf; @@ -2286,6 +2287,9 @@ int ll_ioctl_getfacl(struct inode *inode, struct rmtacl_ioctl_data *ioc) int rc, buflen; ENTRY; + if (!(sbi->ll_flags & LL_SBI_RMT_CLIENT)) + RETURN(-EBADE); + LASSERT(ioc->cmd && ioc->cmd_len && ioc->res && ioc->res_len); OBD_ALLOC(cmd, ioc->cmd_len); @@ -2331,8 +2335,10 @@ int ll_ioctl_setfacl(struct inode *inode, struct rmtacl_ioctl_data *ioc) int buflen, rc; ENTRY; - if (!(sbi->ll_flags & LL_SBI_ACL) || - !(sbi->ll_flags & LL_SBI_RMT_CLIENT)) + if (!(sbi->ll_flags & LL_SBI_RMT_CLIENT)) + RETURN(-EBADE); + + if (!(sbi->ll_flags & LL_SBI_ACL)) RETURN(-EOPNOTSUPP); LASSERT(ioc->cmd && ioc->cmd_len && ioc->res && ioc->res_len); diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 3f4c8df..263e126 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1272,7 +1272,10 @@ int llapi_getfacl(char *fname, char *cmd) rc = ioctl(fd, LL_IOC_GETFACL, &data); close(fd); - if (rc) { + if (errno == EBADE) { + fprintf(stderr, "Please use getfacl directly!\n"); + rc = 1; + } else if (rc) { err_msg("getfacl %s failed", fname); } else { printf("%s", out); @@ -1300,7 +1303,10 @@ int llapi_setfacl(char *fname, char *cmd) rc = ioctl(fd, LL_IOC_SETFACL, &data); close(fd); - if (errno == EOPNOTSUPP) { + if (errno == EBADE) { + fprintf(stderr, "Please use setfacl directly!\n"); + rc = 1; + } else if (errno == EOPNOTSUPP) { fprintf(stderr, "setfacl: %s: %s\n", fname, strerror(errno)); rc = 1; } else if (rc) { -- 1.8.3.1