From: Lai Siyao Date: Thu, 27 Oct 2016 22:11:43 +0000 (-0400) Subject: staging: lustre: dne: setdirstripe should fail if not supported X-Git-Tag: v5.15~12305^2~396 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7291a6d1a807d1391ebf2c4c259681fec149adb;p=platform%2Fkernel%2Flinux-starfive.git staging: lustre: dne: setdirstripe should fail if not supported If MDS doesn't support striped directory, creating striped directory from a userland utility such as 'lfs setdirstripe' should fail. Signed-off-by: Lai Siyao Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6661 Reviewed-on: http://review.whamcloud.com/15123 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 929c32c..6e744a5 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -419,6 +419,10 @@ static int ll_dir_setdirstripe(struct inode *parent, struct lmv_user_md *lump, PFID(ll_inode2fid(parent)), parent, dirname, (int)lump->lum_stripe_offset, lump->lum_stripe_count); + if (lump->lum_stripe_count > 1 && + !(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_DIR_STRIPE)) + return -EINVAL; + if (lump->lum_magic != cpu_to_le32(LMV_USER_MAGIC)) lustre_swab_lmv_user_md(lump);