Skip to contentSkip to conversation

ftruncate04: require CONFIG_MANDATORY_FILE_LOCKING=y

PATCH New Jan Stancek 3 participants 6 messages Sep 6, 2021 – Sep 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftruncate04: require CONFIG_MANDATORY_FILE_LOCKING=y

commit f7e33bdbd6d1 ("fs: remove mandatory file locking support") removed mandatory file locking support, but mount option is still allowed and produces no error. There's a warning in dmesg but it's pr_warn_once() so we can't rely to always find it there.

Make the test check also for CONFIG_MANDATORY_FILE_LOCKING=y.

---
 testcases/kernel/syscalls/ftruncate/ftruncate04.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/ftruncate/ftruncate04.c +4 -0
index ad5c7bbb90ef..c832ceaa659d 100644
@@ -168,6 +168,10 @@ static void setup(void)
 }
 
 static struct tst_test test = {
+	.needs_kconfigs = (const char *[]) {
+		"CONFIG_MANDATORY_FILE_LOCKING=y",
+		NULL
+	},
 	.test_all = verify_ftruncate,
 	.setup = setup,
 	.needs_checkpoints = 1,
Signature · 1 line
2.27.0
#2 lore raw

PATCH 1/1 ftruncate04: require CONFIG_MANDATORY_FILE_LOCKING=y

In reply to Jan Stancek
Quoted 8 lines · Jan Stancek

commit f7e33bdbd6d1 ("fs: remove mandatory file locking support") removed mandatory file locking support, but mount option is still allowed and produces no error. There's a warning in dmesg but it's pr_warn_once() so we can't rely to always find it there.

Make the test check also for CONFIG_MANDATORY_FILE_LOCKING=y.

I'm wondering, if the SUT without CONFIG_MANDATORY_FILE_LOCKING enabling, why the mount-check in setup() didn't report EPERM?

And, should we drop the mount-check for EPERM from setup after adding this .needs_kconfigs?

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210907/53acf06b/attachment.htm>
#3 lore raw

PATCH 1/1 ftruncate04: require CONFIG_MANDATORY_FILE_LOCKING=y

Quoted 10 lines · Li Wang
Quoted 6 lines · Jan Stancek

commit f7e33bdbd6d1 ("fs: remove mandatory file locking support") removed mandatory file locking support, but mount option is still allowed and produces no error. There's a warning in dmesg but it's pr_warn_once() so we can't rely to always find it there.

Quoted 6 lines
Quoted 2 lines

Make the test check also for CONFIG_MANDATORY_FILE_LOCKING=y.

I'm wondering, if the SUT without CONFIG_MANDATORY_FILE_LOCKING enabling, why the mount-check in setup() didn't report EPERM?

Because kernel commit f7e33bdbd6d1 removed that code, it generates warning message instead.

Quoted 4 lines

And, should we drop the mount-check for EPERM from setup after adding this .needs_kconfigs?

I'd keep it, it doesn't hurt anything and older kernels could get EPERM for other reason (like running test in namespace where you don't have CAP_SYS_ADMIN)

Quoted 5 lines

--
Regards,
Li Wang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210907/b1de7d4a/attachment.htm>

#4 lore raw

PATCH 1/1 ftruncate04: require CONFIG_MANDATORY_FILE_LOCKING=y

Quoted 17 lines · Jan Stancek
Quoted 13 lines · Li Wang
Quoted 8 lines · Jan Stancek

commit f7e33bdbd6d1 ("fs: remove mandatory file locking support") removed mandatory file locking support, but mount option is still allowed and produces no error. There's a warning in dmesg but it's pr_warn_once() so we can't rely to always find it there.

Make the test check also for CONFIG_MANDATORY_FILE_LOCKING=y.

Quoted 7 lines
Quoted 3 lines

I'm wondering, if the SUT without CONFIG_MANDATORY_FILE_LOCKING enabling, why the mount-check in setup() didn't report EPERM?

Because kernel commit f7e33bdbd6d1 removed that code, it generates warning message instead.

Ok, I see.

Quoted 4 lines
Quoted 4 lines
Quoted 8 lines
Quoted 3 lines

And, should we drop the mount-check for EPERM from setup after adding this .needs_kconfigs?

I'd keep it, it doesn't hurt anything and older kernels could get EPERM for other reason (like running test in namespace where you don't have CAP_SYS_ADMIN)

Sure, that sounds acceptable too.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210907/32f1db53/attachment.htm>
#5 lore raw

PATCH 1/1 ftruncate04: require CONFIG_MANDATORY_FILE_LOCKING=y

Quoted 40 lines · Li Wang
Quoted 17 lines · Jan Stancek
Quoted 13 lines · Li Wang
Quoted 8 lines · Jan Stancek

commit f7e33bdbd6d1 ("fs: remove mandatory file locking support") removed mandatory file locking support, but mount option is still allowed and produces no error. There's a warning in dmesg but it's pr_warn_once() so we can't rely to always find it there.

Make the test check also for CONFIG_MANDATORY_FILE_LOCKING=y.

Quoted 7 lines
Quoted 3 lines

I'm wondering, if the SUT without CONFIG_MANDATORY_FILE_LOCKING enabling, why the mount-check in setup() didn't report EPERM?

Because kernel commit f7e33bdbd6d1 removed that code, it generates warning message instead.

Ok, I see.

Quoted 8 lines
Quoted 7 lines

And, should we drop the mount-check for EPERM from setup after adding this .needs_kconfigs?

Quoted 9 lines
Quoted 4 lines

I'd keep it, it doesn't hurt anything and older kernels could get EPERM for other reason (like running test in namespace where you don't have CAP_SYS_ADMIN)

Sure, that sounds acceptable too.

Pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210907/b84ea5ad/attachment-0001.htm>