summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-11-07 01:00:24 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 07:53:47 -0800
commit7390022d697bcc62a7556d6fdc61ec56ce3a381a (patch)
treefa3957d2b00d786cd639da56b8ae756ec8b774ce /fs
parent15b7a1b86d663ef40108b1ba322973e32d5b62d6 (diff)
downloadlinux-3.10-7390022d697bcc62a7556d6fdc61ec56ce3a381a.tar.gz
linux-3.10-7390022d697bcc62a7556d6fdc61ec56ce3a381a.tar.bz2
linux-3.10-7390022d697bcc62a7556d6fdc61ec56ce3a381a.zip
[PATCH] knfsd: Restore functionality to read from file in /proc/fs/nfsd/
Most files in the nfsd filesystems are transaction files. You write a request, and read a response. For some (e.g. 'threads') it makes sense to just be able to read and get the current value. This functionality did exist but was broken recently when someone modified nfsctl.c without going through the maintainer. This patch fixes the regression. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfsctl.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 841c562991e..2a99a0bf54f 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -104,9 +104,23 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu
return rv;
}
+static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
+{
+ if (! file->private_data) {
+ /* An attempt to read a transaction file without writing
+ * causes a 0-byte write so that the file can return
+ * state information
+ */
+ ssize_t rv = nfsctl_transaction_write(file, buf, 0, pos);
+ if (rv < 0)
+ return rv;
+ }
+ return simple_transaction_read(file, buf, size, pos);
+}
+
static struct file_operations transaction_ops = {
.write = nfsctl_transaction_write,
- .read = simple_transaction_read,
+ .read = nfsctl_transaction_read,
.release = simple_transaction_release,
};