From: NeilBrown <neilb@suse.de>
To: Steve Dickson <SteveD@redhat.com>
Cc: NFS <linux-nfs@vger.kernel.org>,
Sean Finney <sean.finney@sonyericsson.com>
Subject: [nfs-utils PATCH] mountd: fix checking for errors when exporting filesystems.
Date: Thu, 13 Dec 2012 11:25:29 +1100 [thread overview]
Message-ID: <20121213112529.06ebda22@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
commit 5604b35a61e22930873ffc4e9971002f578e7978
nfs-utils: Increase the stdio file buffer size for procfs files
changed writes to some sysfs files to be line buffered (_IOLBF) where
they weren't before. While this probably makes sense, it introduced a bug.
With fully buffered streams, you don't expect to get an error until you
call fflush().
With line buffered streams you can get the error from fprintf() et al.
qword_eol() only tests the return from fflush(), not from fprintf(). Consequently
errors were not noticed.
One result of this is that if you export, with crossmnt, a filesystem underneath
which are mounted non-exportable filesystems (e.g. /proc) then an 'ls -l' on the
client will block indefinitely waiting for a meaningful 'yes' or 'no' from the
server, but will never get one.
This patch changes qword_eol to test both fprintf and fflush.
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
index e641c45..61e07a8 100644
--- a/support/nfs/cacheio.c
+++ b/support/nfs/cacheio.c
@@ -162,11 +162,16 @@ int qword_eol(FILE *f)
{
int err;
- fprintf(f,"\n");
- err = fflush(f);
- if (err) {
- xlog_warn("qword_eol: fflush failed: errno %d (%s)",
+ err = fprintf(f,"\n");
+ if (err < 0) {
+ xlog_warn("qword_eol: fprintf failed: errno %d (%s)",
errno, strerror(errno));
+ } else {
+ err = fflush(f);
+ if (err) {
+ xlog_warn("qword_eol: fflush failed: errno %d (%s)",
+ errno, strerror(errno));
+ }
}
/*
* We must send one line (and one line only) in a single write
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2012-12-13 0:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-13 0:25 NeilBrown [this message]
2012-12-13 15:53 ` [nfs-utils PATCH] mountd: fix checking for errors when exporting filesystems J. Bruce Fields
2012-12-17 21:45 ` Steve Dickson
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=20121213112529.06ebda22@notabene.brown \
--to=neilb@suse.de \
--cc=SteveD@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=sean.finney@sonyericsson.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).