* [PATCH] ocfs2: make ocfs2_calc_xattr_init() return void
@ 2026-09-04 2:37 Joseph Qi
2026-09-04 4:36 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Joseph Qi @ 2026-09-04 2:37 UTC (permalink / raw)
To: Andrew Morton, Heming Zhao
Cc: Mark Fasheh, Joel Becker, ocfs2-devel, linux-kernel
ocfs2_calc_xattr_init() used to read the default ACL off the parent
inode itself, so it could return an error from ocfs2_xattr_get_nolock().
Commit bd7c05fb4a47 ("ocfs2: fix circular locking dependency in
ocfs2_init_acl()") moved that lookup before the transaction starts and
deleted the error path, but left the now vestigial 'int ret = 0'
declaration and both 'return ret' statements behind, along with an
unreachable error branch in ocfs2_mknod().
Drop the leftover variable and convert the return type to void, so the
callee states that it always succeeds and the caller no longer carries
a check that can never trigger.
No functional change.
Fixes: bd7c05fb4a47 ("ocfs2: fix circular locking dependency in ocfs2_init_acl()")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202609040247.8B3lmoqX-lkp@intel.com/
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
fs/ocfs2/namei.c | 9 ++-------
fs/ocfs2/xattr.c | 13 +++++--------
fs/ocfs2/xattr.h | 8 ++++----
3 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index fea889b9f577..ef03f90e7265 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -335,13 +335,8 @@ static int ocfs2_mknod(struct mnt_idmap *idmap,
goto leave;
/* calculate meta data/clusters for setting security and acl xattr */
- status = ocfs2_calc_xattr_init(dir, mode, &si, &want_clusters,
- &xattr_credits, &want_meta,
- &acl_state);
- if (status < 0) {
- mlog_errno(status);
- goto leave;
- }
+ ocfs2_calc_xattr_init(dir, mode, &si, &want_clusters, &xattr_credits,
+ &want_meta, &acl_state);
/* Reserve a cluster if creating an extent based directory. */
if (S_ISDIR(mode) && !ocfs2_supports_inline_data(osb)) {
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index f30faabf601b..f2b7a53ed969 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -682,13 +682,12 @@ int ocfs2_calc_security_init(struct inode *dir,
return ret;
}
-int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
- struct ocfs2_security_xattr_info *si,
- int *want_clusters, int *xattr_credits,
- int *want_meta, struct ocfs2_acl_state *acl_state)
+void ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
+ struct ocfs2_security_xattr_info *si,
+ int *want_clusters, int *xattr_credits,
+ int *want_meta, struct ocfs2_acl_state *acl_state)
{
int i;
- int ret = 0;
struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
int s_size = 0, a_size = 0, acl_len = 0, new_clusters;
@@ -713,7 +712,7 @@ int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
}
if (!(s_size + a_size))
- return ret;
+ return;
/*
* The max space of security xattr taken inline is
@@ -781,8 +780,6 @@ int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
}
}
}
-
- return ret;
}
static int ocfs2_xattr_extend_allocation(struct inode *inode,
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
index 70a6a9dab71e..1dd08f979e3c 100644
--- a/fs/ocfs2/xattr.h
+++ b/fs/ocfs2/xattr.h
@@ -65,10 +65,10 @@ int ocfs2_calc_security_init(struct inode *,
int *, int *, struct ocfs2_alloc_context **);
struct ocfs2_acl_state;
-int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
- struct ocfs2_security_xattr_info *si,
- int *want_clusters, int *xattr_credits,
- int *want_meta, struct ocfs2_acl_state *acl_state);
+void ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
+ struct ocfs2_security_xattr_info *si,
+ int *want_clusters, int *xattr_credits,
+ int *want_meta, struct ocfs2_acl_state *acl_state);
/*
* xattrs can live inside an inode, as part of an external xattr block,
--
2.39.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ocfs2: make ocfs2_calc_xattr_init() return void
2026-09-04 2:37 [PATCH] ocfs2: make ocfs2_calc_xattr_init() return void Joseph Qi
@ 2026-09-04 4:36 ` Andrew Morton
2026-09-04 7:06 ` Joseph Qi
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-09-04 4:36 UTC (permalink / raw)
To: Joseph Qi
Cc: Heming Zhao, Mark Fasheh, Joel Becker, ocfs2-devel, linux-kernel
On Fri, 4 Sep 2026 10:37:51 +0800 Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
> ocfs2_calc_xattr_init() used to read the default ACL off the parent
> inode itself, so it could return an error from ocfs2_xattr_get_nolock().
> Commit bd7c05fb4a47 ("ocfs2: fix circular locking dependency in
> ocfs2_init_acl()") moved that lookup before the transaction starts and
> deleted the error path, but left the now vestigial 'int ret = 0'
> declaration and both 'return ret' statements behind, along with an
> unreachable error branch in ocfs2_mknod().
>
> Drop the leftover variable and convert the return type to void, so the
> callee states that it always succeeds and the caller no longer carries
> a check that can never trigger.
>
> No functional change.
Thanks.
> Fixes: bd7c05fb4a47 ("ocfs2: fix circular locking dependency in ocfs2_init_acl()")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609040247.8B3lmoqX-lkp@intel.com/
Gee, that's a bit picky, isn't it?
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ocfs2: make ocfs2_calc_xattr_init() return void
2026-09-04 4:36 ` Andrew Morton
@ 2026-09-04 7:06 ` Joseph Qi
0 siblings, 0 replies; 3+ messages in thread
From: Joseph Qi @ 2026-09-04 7:06 UTC (permalink / raw)
To: Andrew Morton
Cc: Heming Zhao, Mark Fasheh, Joel Becker, ocfs2-devel, linux-kernel
On 9/4/26 12:36 PM, Andrew Morton wrote:
> On Fri, 4 Sep 2026 10:37:51 +0800 Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
>
>> ocfs2_calc_xattr_init() used to read the default ACL off the parent
>> inode itself, so it could return an error from ocfs2_xattr_get_nolock().
>> Commit bd7c05fb4a47 ("ocfs2: fix circular locking dependency in
>> ocfs2_init_acl()") moved that lookup before the transaction starts and
>> deleted the error path, but left the now vestigial 'int ret = 0'
>> declaration and both 'return ret' statements behind, along with an
>> unreachable error branch in ocfs2_mknod().
>>
>> Drop the leftover variable and convert the return type to void, so the
>> callee states that it always succeeds and the caller no longer carries
>> a check that can never trigger.
>>
>> No functional change.
>
> Thanks.
>
>> Fixes: bd7c05fb4a47 ("ocfs2: fix circular locking dependency in ocfs2_init_acl()")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202609040247.8B3lmoqX-lkp@intel.com/
>
> Gee, that's a bit picky, isn't it?
It's indeed a trivial fix.
I've followed the report mail to add the tags and I think it may help
kernel test robot tracking.
Thanks,
Joseph
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-04 7:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 2:37 [PATCH] ocfs2: make ocfs2_calc_xattr_init() return void Joseph Qi
2026-09-04 4:36 ` Andrew Morton
2026-09-04 7:06 ` Joseph Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®