diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-11-07 04:00:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:47 -0500 |
commit | 7390022d697bcc62a7556d6fdc61ec56ce3a381a (patch) | |
tree | fa3957d2b00d786cd639da56b8ae756ec8b774ce /fs/nfsd | |
parent | 15b7a1b86d663ef40108b1ba322973e32d5b62d6 (diff) |
[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/nfsd')
-rw-r--r-- | fs/nfsd/nfsctl.c | 16 |
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 | |||
104 | return rv; | 104 | return rv; |
105 | } | 105 | } |
106 | 106 | ||
107 | static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) | ||
108 | { | ||
109 | if (! file->private_data) { | ||
110 | /* An attempt to read a transaction file without writing | ||
111 | * causes a 0-byte write so that the file can return | ||
112 | * state information | ||
113 | */ | ||
114 | ssize_t rv = nfsctl_transaction_write(file, buf, 0, pos); | ||
115 | if (rv < 0) | ||
116 | return rv; | ||
117 | } | ||
118 | return simple_transaction_read(file, buf, size, pos); | ||
119 | } | ||
120 | |||
107 | static struct file_operations transaction_ops = { | 121 | static struct file_operations transaction_ops = { |
108 | .write = nfsctl_transaction_write, | 122 | .write = nfsctl_transaction_write, |
109 | .read = simple_transaction_read, | 123 | .read = nfsctl_transaction_read, |
110 | .release = simple_transaction_release, | 124 | .release = simple_transaction_release, |
111 | }; | 125 | }; |
112 | 126 | ||