From: Zach Brown <zab@redhat.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests 311: test fsync with dm flakey
Date: Mon, 22 Apr 2013 15:31:14 -0700 [thread overview]
Message-ID: <20130422223114.GD25389@lenny.home.zabbo.net> (raw)
In-Reply-To: <1366665213-17894-1-git-send-email-jbacik@fusionio.com>
> +static void drop_all_caches()
> +{
> + int value = 3;
> + int fd;
> +
> + if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) < 0) {
> + fprintf(stderr, "Error opening drop caches: %d\n", errno);
> + return;
> + }
> +
> + write(fd, &value, sizeof(int));
> + close(fd);
> +}
fwiw drop_caches takes an ascii string, not a native int:
open("/proc/sys/vm/drop_caches", O_WRONLY) = 3
write(3, "\3\0\0\0", 4) = -1 EINVAL (Invalid argument)
--- test.c.busted 2013-04-22 15:22:57.593575545 -0700
+++ test.c 2013-04-22 15:29:25.358072087 -0700
@@ -7,7 +7,7 @@
static void drop_all_caches()
{
- int value = 3;
+ char value[] = "3\n";
int fd;
if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) < 0) {
@@ -15,7 +15,7 @@
return;
}
- write(fd, &value, sizeof(int));
+ write(fd, value, sizeof(value) - 1);
close(fd);
}
open("/proc/sys/vm/drop_caches", O_WRONLY) = 3
write(3, "3\n", 2) = 2
and all this makes me think that the write() return should probably have
been checked :).
- z
WARNING: multiple messages have this Message-ID (diff)
From: Zach Brown <zab@redhat.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests 311: test fsync with dm flakey
Date: Mon, 22 Apr 2013 15:31:14 -0700 [thread overview]
Message-ID: <20130422223114.GD25389@lenny.home.zabbo.net> (raw)
In-Reply-To: <1366665213-17894-1-git-send-email-jbacik@fusionio.com>
> +static void drop_all_caches()
> +{
> + int value = 3;
> + int fd;
> +
> + if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) < 0) {
> + fprintf(stderr, "Error opening drop caches: %d\n", errno);
> + return;
> + }
> +
> + write(fd, &value, sizeof(int));
> + close(fd);
> +}
fwiw drop_caches takes an ascii string, not a native int:
open("/proc/sys/vm/drop_caches", O_WRONLY) = 3
write(3, "\3\0\0\0", 4) = -1 EINVAL (Invalid argument)
--- test.c.busted 2013-04-22 15:22:57.593575545 -0700
+++ test.c 2013-04-22 15:29:25.358072087 -0700
@@ -7,7 +7,7 @@
static void drop_all_caches()
{
- int value = 3;
+ char value[] = "3\n";
int fd;
if ((fd = open("/proc/sys/vm/drop_caches", O_WRONLY)) < 0) {
@@ -15,7 +15,7 @@
return;
}
- write(fd, &value, sizeof(int));
+ write(fd, value, sizeof(value) - 1);
close(fd);
}
open("/proc/sys/vm/drop_caches", O_WRONLY) = 3
write(3, "3\n", 2) = 2
and all this makes me think that the write() return should probably have
been checked :).
- z
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-04-22 22:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 21:13 [PATCH] xfstests 311: test fsync with dm flakey Josef Bacik
2013-04-22 21:13 ` Josef Bacik
2013-04-22 22:31 ` Zach Brown [this message]
2013-04-22 22:31 ` Zach Brown
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=20130422223114.GD25389@lenny.home.zabbo.net \
--to=zab@redhat.com \
--cc=jbacik@fusionio.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=xfs@oss.sgi.com \
/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.