orangefs: hopefully saner op refcounting and locking
* create with refcount 1
* make op_release() decrement and free if zero (i.e. old put_op()
has become that).
* mark when submitter has given up waiting; from that point nobody
else can move between the lists, change state, etc.
* have daemon read/write_iter grab a reference when picking op
and *always* give it up in the end
* don't put into hash until we know it's been successfully passed to
daemon
* move op->lock _lower_ than htab_in_progress_lock (and make sure
to take it in purge_inprogress_ops())
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 171013a..df3404b 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -105,10 +105,9 @@
ssize_t ret;
new_op = op_alloc(ORANGEFS_VFS_OP_FILE_IO);
- if (!new_op) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!new_op)
+ return -ENOMEM;
+
/* synchronous I/O */
new_op->upcall.req.io.async_vfs_io = ORANGEFS_VFS_SYNC_IO;
new_op->upcall.req.io.readahead_size = readahead_size;
@@ -234,12 +233,9 @@
/*
* tell the device file owner waiting on I/O that this read has
- * completed and it can return now. in this exact case, on
- * wakeup the daemon will free the op, so we *cannot* touch it
- * after this.
+ * completed and it can return now.
*/
wake_up_daemon_for_return(new_op);
- new_op = NULL;
out:
if (buffer_index >= 0) {
@@ -249,10 +245,7 @@
__func__, handle, buffer_index);
buffer_index = -1;
}
- if (new_op) {
- op_release(new_op);
- new_op = NULL;
- }
+ op_release(new_op);
return ret;
}