aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLai Siyao <lai.siyao@intel.com>2017-01-28 19:04:53 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-03 07:01:37 -0500
commite27bcd66cb84b67a1231e5c6245673826673b66d (patch)
treebd5bb0a4080fee79ee3c506eae241379ee5e5f82
parente39cb21b33dbacd8ad25e926fd9159da175833c2 (diff)
staging: lustre: llite: normal user can't set FS default stripe
Current client doesn't check permission before updating filesystem default stripe on MGS, which isn't secure and obvious. Since we setattr on MDS first, and then set default stripe on MGS, we can just return error upon setattr failure. Now filesystem default stripe is stored in ROOT in MDT, so saving it in system config is for compatibility with old servers, this will be removed in the future. Signed-off-by: Lai Siyao <lai.siyao@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8454 Reviewed-on: http://review.whamcloud.com/21612 Reviewed-on: http://review.whamcloud.com/22580 Reviewed-by: Jian Yu <jian.yu@intel.com> Reviewed-by: Bobi Jam <bobijam@hotmail.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/llite/dir.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 526fea266926..13b35922a4ca 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -521,12 +521,15 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
521 rc = md_setattr(sbi->ll_md_exp, op_data, lump, lum_size, &req); 521 rc = md_setattr(sbi->ll_md_exp, op_data, lump, lum_size, &req);
522 ll_finish_md_op_data(op_data); 522 ll_finish_md_op_data(op_data);
523 ptlrpc_req_finished(req); 523 ptlrpc_req_finished(req);
524 if (rc) { 524 if (rc)
525 if (rc != -EPERM && rc != -EACCES) 525 return rc;
526 CERROR("mdc_setattr fails: rc = %d\n", rc);
527 }
528 526
529 /* In the following we use the fact that LOV_USER_MAGIC_V1 and 527#if OBD_OCD_VERSION(2, 13, 53, 0) > LUSTRE_VERSION_CODE
528 /*
529 * 2.9 server has stored filesystem default stripe in ROOT xattr,
530 * and it's stored into system config for backward compatibility.
531 *
532 * In the following we use the fact that LOV_USER_MAGIC_V1 and
530 * LOV_USER_MAGIC_V3 have the same initial fields so we do not 533 * LOV_USER_MAGIC_V3 have the same initial fields so we do not
531 * need to make the distinction between the 2 versions 534 * need to make the distinction between the 2 versions
532 */ 535 */
@@ -567,6 +570,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
567end: 570end:
568 kfree(param); 571 kfree(param);
569 } 572 }
573#endif
570 return rc; 574 return rc;
571} 575}
572 576