Whamcloud - gitweb
LU-18718 llite: cl_file_inode_init() only for regular file 57/58057/5
authorBobi Jam <bobijam@whamcloud.com>
Thu, 13 Feb 2025 07:37:10 +0000 (15:37 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 28 Feb 2025 08:10:28 +0000 (08:10 +0000)
cl_file_inode_init() only applies to regular files, so we'd avoid
LBUG-ing it if the pre-condition is not met.

cl_file_inode_init()) ASSERTION((((inode->i_mode) & 00170000)
                                == 0100000)) failed:
Call Trace:
  dump_stack+0x41/0x60
  lbug_with_loc.cold.8+0x5/0x58 [libcfs]
  cl_file_inode_init+0x216/0x390 [lustre]
  ll_update_inode+0x44f/0x710 [lustre]
  ll_iget+0x228/0x320 [lustre]
  ll_prep_inode+0x3e5/0xa10 [lustre]
  ll_lookup_it_finish.constprop.32+0xce/0x10a0 [lustre]
  ll_lookup_it+0x82f/0x1840 [lustre]
  ll_lookup_nd+0x112/0x1c0 [lustre]
  __lookup_hash+0x75/0xa0
  do_unlinkat+0x156/0x300
  do_syscall_64+0x5b/0x1a0
  entry_SYSCALL_64_after_hwframe+0x66/0xcb

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I7fef2645ef040cb3c3fd6e4ece062e1c9ab64327
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58057
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/lcommon_cl.c

index 027a0ad..1169544 100644 (file)
@@ -127,8 +127,8 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
        int result = 0;
        __u16 refcheck;
 
-       LASSERT(md->body->mbo_valid & OBD_MD_FLID);
-       LASSERT(S_ISREG(inode->i_mode));
+       if (!(md->body->mbo_valid & OBD_MD_FLID) || !S_ISREG(inode->i_mode))
+               return 0;
 
        env = cl_env_get(&refcheck);
        if (IS_ERR(env))