From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753185AbdA2ANU (ORCPT ); Sat, 28 Jan 2017 19:13:20 -0500 Received: from [160.91.203.10] ([160.91.203.10]:49022 "EHLO smtp1.ccs.ornl.gov" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752896AbdA2AMR (ORCPT ); Sat, 28 Jan 2017 19:12:17 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , Lai Siyao , James Simmons Subject: [PATCH 25/60] staging: lustre: llite: normal user can't set FS default stripe Date: Sat, 28 Jan 2017 19:04:53 -0500 Message-Id: <1485648328-2141-26-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Siyao 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 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 Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 526fea2..13b3592 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, 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); - } + if (rc) + return rc; - /* In the following we use the fact that LOV_USER_MAGIC_V1 and +#if OBD_OCD_VERSION(2, 13, 53, 0) > LUSTRE_VERSION_CODE + /* + * 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 to make the distinction between the 2 versions */ @@ -567,6 +570,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, end: kfree(param); } +#endif return rc; } -- 1.8.3.1