From 33082e057d214793c70085a33f1d82b3915db3a9 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 10 Jan 2020 09:30:47 -0500 Subject: [PATCH] LU-13119 osd-ldiskfs: set f_cred for app armour The function interate_dir() interfaces with the security layer. For some kernel versions on platforms that use app armour it expects f_cred to be set. Currently osd-ldiskfs open codes the creation of struct file so it is missing a cred. Fix this by setting f_cred to the default current_cred(). Test-Parameters: testlist=sanity-lfsck serverdistro=sles12sp3 Change-Id: I38487e8ae99a0f70d6e430935b7d19523d414b4b Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/37184 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Li Dongyang --- lustre/osd-ldiskfs/osd_handler.c | 2 ++ lustre/osd-ldiskfs/osd_scrub.c | 1 + 2 files changed, 3 insertions(+) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 466da64..1b71fc6 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1012,6 +1012,7 @@ again: filp->f_mapping = inode->i_mapping; filp->f_op = fops; filp->private_data = NULL; + filp->f_cred = current_cred(); set_file_inode(filp, inode); rc = osd_security_file_alloc(filp); if (rc) @@ -6621,6 +6622,7 @@ static int osd_ldiskfs_it_fill(const struct lu_env *env, down_read(&obj->oo_ext_idx_sem); } + filp->f_cred = current_cred(); rc = osd_security_file_alloc(filp); if (rc) RETURN(rc); diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index b692261..63c295b 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -2263,6 +2263,7 @@ osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev, filp->f_mapping = inode->i_mapping; filp->f_op = fops; filp->private_data = NULL; + filp->f_cred = current_cred(); set_file_inode(filp, inode); rc = osd_security_file_alloc(filp); if (rc) -- 1.8.3.1