From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Alan Cox <alan@redhat.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
NFS maillist <nfs@lists.sourceforge.net>
Subject: [PATCH] 2.4.9 Fix 'noac' and 'sync' mount flags
Date: Sat, 8 Sep 2001 18:24:11 +0200 [thread overview]
Message-ID: <15258.17964.30516.825575@charged.uio.no> (raw)
Hi,
The following patch has been requested by people who are interested in
using databases over NFS. Basically they argue that our implementation
of the 'noac' mount flag differs from that of other *NIX in that we
still allow asynchronous writes. As 'noac' is supposed to mean no
attribute caching, caching writes on the client is a violation.
For various reasons, they also argue against adapting the 'O_SYNC'
style behaviour of firing off asynchronous writes, and then using
generic_osync_inode() to sync the data.
Basically they want 'noac' to ensure that only 1 NFS_STABLE write is
going down the wire at any point in time as this is the standard *NIX
behaviour.
After having studied the problem, we've come to the conclusion
therefore that the best solution is the following, in which we simply
use nfs_writepage_sync(). That limits the effective wsize to being <=
PAGE_CACHE_SIZE, but it's the only way of avoiding races.
Incidentally, the patch also fixes a typo in nfs_writepage() in which
I have used the rsize rather than wsize in deciding whether or not to
use asynchronous writes.
Cheers,
Trond
diff -u --recursive --new-file linux-2.4.9/fs/nfs/inode.c linux-2.4.9-sync/fs/nfs/inode.c
--- linux-2.4.9/fs/nfs/inode.c Thu Aug 16 18:39:37 2001
+++ linux-2.4.9-sync/fs/nfs/inode.c Thu Aug 30 09:13:33 2001
@@ -312,6 +312,7 @@
if (data->flags & NFS_MOUNT_NOAC) {
data->acregmin = data->acregmax = 0;
data->acdirmin = data->acdirmax = 0;
+ sb->s_flags |= MS_SYNCHRONOUS;
}
server->acregmin = data->acregmin*HZ;
server->acregmax = data->acregmax*HZ;
diff -u --recursive --new-file linux-2.4.9/fs/nfs/write.c linux-2.4.9-sync/fs/nfs/write.c
--- linux-2.4.9/fs/nfs/write.c Thu Aug 16 18:39:37 2001
+++ linux-2.4.9-sync/fs/nfs/write.c Thu Aug 30 09:31:37 2001
@@ -288,7 +288,7 @@
goto out;
do_it:
lock_kernel();
- if (NFS_SERVER(inode)->rsize >= PAGE_CACHE_SIZE) {
+ if (NFS_SERVER(inode)->wsize >= PAGE_CACHE_SIZE && !IS_SYNC(inode)) {
err = nfs_writepage_async(NULL, inode, page, 0, offset);
if (err >= 0)
err = 0;
@@ -1031,7 +1031,7 @@
* If wsize is smaller than page size, update and write
* page synchronously.
*/
- if (NFS_SERVER(inode)->wsize < PAGE_SIZE)
+ if (NFS_SERVER(inode)->wsize < PAGE_CACHE_SIZE || IS_SYNC(inode))
return nfs_writepage_sync(file, inode, page, offset, count);
/*
reply other threads:[~2001-09-08 16:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=15258.17964.30516.825575@charged.uio.no \
--to=trond.myklebust@fys.uio.no \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
--cc=torvalds@transmeta.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
all inboxes | Powered by JetHome®