diff options
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 841c562991e8..2a99a0bf54f6 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 | ||