All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 3/3] syscalls/ftruncate: Rewrite ftruncate04
Date: Tue, 13 Aug 2019 17:10:01 +0200	[thread overview]
Message-ID: <20190813151001.GC23369@rei.lan> (raw)
In-Reply-To: <1564645349-10859-3-git-send-email-huangjh.jy@cn.fujitsu.com>

Hi!
Pushed with a few changes, thanks.

diff --git a/testcases/kernel/syscalls/ftruncate/ftruncate04.c b/testcases/kernel/syscalls/ftruncate/ftruncate04.c
index 097c283f4..53d395d1f 100644
--- a/testcases/kernel/syscalls/ftruncate/ftruncate04.c
+++ b/testcases/kernel/syscalls/ftruncate/ftruncate04.c
@@ -38,7 +38,7 @@
 #define MNTPOINT	"mntpoint"
 #define TESTFILE	MNTPOINT"/testfile"
 
-static int len = 1024;
+static int len = 8 * 1024;
                  ^
		  This was needlessly modified so I just returned it to
		  previous value.

 static int recstart, reclen;
 
 static void ftruncate_expect_fail(int fd, off_t offset, const char *msg)
@@ -151,14 +151,11 @@ static void verify_ftruncate(void)
 
 static void setup(void)
 {
-	struct statvfs fs;
-
-	if (statvfs(".", &fs) == -1)
-		tst_brk(TFAIL | TERRNO, "statvfs failed");
-
-	if ((fs.f_flag & MS_MANDLOCK))
-		return;
-

When the test was mounting the device in the setup this code was here to
skip the mkfs and mount in a case that the tmp was mounted with
mandatory locking, but after the change to .mount_device it became
meaningless. Moreover it would break the test in a case that the TMPDIR
was in fact mounted with mandatory locking.

+	 /*
+	  * Kernel returns EPERM when CONFIG_MANDATORY_FILE_LOCKING is not
+	  * supported - to avoid false negatives, mount the fs first without
+	  * flags and then remount it as MS_MANDLOCK
+	  */

And I've restored this comment as this is one of the places where it
makes sense to explain why we are not mounting the fs with MS_MANDLOCK
in the first place.

 	if (mount(NULL, MNTPOINT, NULL, MS_REMOUNT|MS_MANDLOCK, NULL) == -1) {
 		if (errno == EPERM) {
 			tst_brk(TCONF,
@@ -177,5 +174,6 @@ static struct tst_test test = {
 	.needs_tmpdir = 1,
 	.forks_child = 1,
 	.mount_device = 1,
+	.needs_root = 1,
 	.mntpoint = MNTPOINT,
 };

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2019-08-13 15:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 10:11 [LTP] [PATCH 1/3] syscalls/ftruncate: Rewrite ftruncate01 and merge ftruncate02 Jinhui huang
2019-07-29 10:11 ` [LTP] [PATCH 2/3] syscalls/ftruncate: Rewrite ftruncate03 Jinhui huang
2019-07-30 12:55   ` Cyril Hrubis
2019-07-29 10:11 ` [LTP] [PATCH 3/3] syscalls/ftruncate: Rewtite ftruncate04 Jinhui huang
2019-07-30 13:06   ` Cyril Hrubis
2019-08-01  7:42   ` [LTP] [PATCH v2 1/3] syscalls/ftruncate: Rewrite ftruncate01 and merge ftruncate02 Jinhui huang
2019-08-01  7:42     ` [LTP] [PATCH v2 2/3] syscalls/ftruncate: Rewrite ftruncate03 and add new error test Jinhui huang
2019-08-13 14:37       ` Cyril Hrubis
2019-08-01  7:42     ` [LTP] [PATCH v2 3/3] syscalls/ftruncate: Rewrite ftruncate04 Jinhui huang
2019-08-13 15:10       ` Cyril Hrubis [this message]
2019-08-13 14:20     ` [LTP] [PATCH v2 1/3] syscalls/ftruncate: Rewrite ftruncate01 and merge ftruncate02 Cyril Hrubis
2019-07-30 12:37 ` [LTP] [PATCH " Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190813151001.GC23369@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.