lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b3d6db6f-61d8-498a-b90c-0716a64f7528@huaweicloud.com>
Date: Sat, 17 May 2025 07:54:55 +0800
From: Zizhi Wo <wozizhi@...weicloud.com>
To: Jan Kara <jack@...e.cz>
Cc: viro@...iv.linux.org.uk, brauner@...nel.org,
 linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
 yangerkun@...wei.com
Subject: Re: [PATCH] fs: Rename the parameter of mnt_get_write_access()



在 2025/5/16 18:31, Jan Kara 写道:
> On Fri 16-05-25 11:21:47, Zizhi Wo wrote:
>> From: Zizhi Wo <wozizhi@...wei.com>
>>
>> Rename the parameter in mnt_get_write_access() from "m" to "mnt" for
>> consistency between declaration and implementation.
>>
>> Signed-off-by: Zizhi Wo <wozizhi@...wei.com>
> 
> I'm sorry but this is just a pointless churn. I agree the declaration and
> implementation should better be consistent (although in this particular
> case it isn't too worrying) but it's much easier (and with much lower
> chance to cause conflicts) to just fixup the declaration.
> 
> 								Honza

Yes, I had considered simply fixing the declaration earlier. However, in
the include/linux/mount.h file, similar functions like
"mnt_put_write_access" use "mnt" as the parameter name rather than "m",
just like "mnt_get_write_access". So I chose to modify the function
implementation directly, although this resulted in a larger amount of
changes. So as you can see, for simplicity, I will directly update the
parameter name in the function declaration in the second version.

Thanks,
Zizhi Wo

> 
>> ---
>>   fs/namespace.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/fs/namespace.c b/fs/namespace.c
>> index 1b466c54a357..b1b679433ab3 100644
>> --- a/fs/namespace.c
>> +++ b/fs/namespace.c
>> @@ -483,7 +483,7 @@ static int mnt_is_readonly(struct vfsmount *mnt)
>>    */
>>   /**
>>    * mnt_get_write_access - get write access to a mount without freeze protection
>> - * @m: the mount on which to take a write
>> + * @mnt: the mount on which to take a write
>>    *
>>    * This tells the low-level filesystem that a write is about to be performed to
>>    * it, and makes sure that writes are allowed (mnt it read-write) before
>> @@ -491,13 +491,13 @@ static int mnt_is_readonly(struct vfsmount *mnt)
>>    * frozen. When the write operation is finished, mnt_put_write_access() must be
>>    * called. This is effectively a refcount.
>>    */
>> -int mnt_get_write_access(struct vfsmount *m)
>> +int mnt_get_write_access(struct vfsmount *mnt)
>>   {
>> -	struct mount *mnt = real_mount(m);
>> +	struct mount *m = real_mount(mnt);
>>   	int ret = 0;
>>   
>>   	preempt_disable();
>> -	mnt_inc_writers(mnt);
>> +	mnt_inc_writers(m);
>>   	/*
>>   	 * The store to mnt_inc_writers must be visible before we pass
>>   	 * MNT_WRITE_HOLD loop below, so that the slowpath can see our
>> @@ -505,7 +505,7 @@ int mnt_get_write_access(struct vfsmount *m)
>>   	 */
>>   	smp_mb();
>>   	might_lock(&mount_lock.lock);
>> -	while (READ_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD) {
>> +	while (READ_ONCE(m->mnt.mnt_flags) & MNT_WRITE_HOLD) {
>>   		if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
>>   			cpu_relax();
>>   		} else {
>> @@ -530,8 +530,8 @@ int mnt_get_write_access(struct vfsmount *m)
>>   	 * read-only.
>>   	 */
>>   	smp_rmb();
>> -	if (mnt_is_readonly(m)) {
>> -		mnt_dec_writers(mnt);
>> +	if (mnt_is_readonly(mnt)) {
>> +		mnt_dec_writers(m);
>>   		ret = -EROFS;
>>   	}
>>   	preempt_enable();
>> -- 
>> 2.39.2
>>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ