Whamcloud - gitweb
Local client should not use "lfs getfacl / lfs setfacl".
authorfanyong <fanyong>
Mon, 30 Oct 2006 02:31:53 +0000 (02:31 +0000)
committerfanyong <fanyong>
Mon, 30 Oct 2006 02:31:53 +0000 (02:31 +0000)
lustre/llite/llite_lib.c
lustre/utils/liblustreapi.c

index 99f9a34..d5928d9 100644 (file)
@@ -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);
index 3f4c8df..263e126 100644 (file)
@@ -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) {