Whamcloud - gitweb
LU-8454 llite: normal user can't set FS default stripe
[fs/lustre-release.git] / lustre / llite / dir.c
index b0cfb5b..ea0c35c 100644 (file)
@@ -594,19 +594,23 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
         if (IS_ERR(op_data))
                 RETURN(PTR_ERR(op_data));
 
-        /* swabbing is done in lov_setstripe() on server side */
+       /* swabbing is done in lov_setstripe() on server side */
        rc = md_setattr(sbi->ll_md_exp, op_data, lump, lum_size, &req);
-        ll_finish_md_op_data(op_data);
-        ptlrpc_req_finished(req);
-        if (rc) {
-                if (rc != -EPERM && rc != -EACCES)
-                        CERROR("mdc_setattr fails: rc = %d\n", rc);
-        }
+       ll_finish_md_op_data(op_data);
+       ptlrpc_req_finished(req);
+       if (rc)
+               RETURN(rc);
 
-        /* In the following we use the fact that LOV_USER_MAGIC_V1 and
-         LOV_USER_MAGIC_V3 have the same initial fields so we do not
-         need the make the distiction between the 2 versions */
-        if (set_default && mgc->u.cli.cl_mgc_mgsexp) {
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 50, 0)
+       /*
+        * 2.9 server has stored filesystem default stripe in ROOT xattr,
+        * and it's stored into system config for backward compatibility.
+        *
+        * In the following we use the fact that LOV_USER_MAGIC_V1 and
+        * LOV_USER_MAGIC_V3 have the same initial fields so we do not
+        * need the make the distiction between the 2 versions
+        */
+       if (set_default && mgc->u.cli.cl_mgc_mgsexp) {
                char *param = NULL;
                char *buf;
 
@@ -644,6 +648,7 @@ end:
                if (param != NULL)
                        OBD_FREE(param, MGS_PARAM_MAXLEN);
        }
+#endif
        RETURN(rc);
 }