}
}
-/* This one is currently only used for sending the FORGET request, which is
- a kernel initiated request. So the outstanding semaphore is not used. */
+/* This one is currently only used for sending FORGET and RELEASE,
+ which are kernel initiated request. So the outstanding semaphore
+ is not used. */
int request_send_noreply(struct fuse_conn *fc, struct fuse_in *in)
{
struct fuse_req *req;
INIT_LIST_HEAD(&fc->processing);
sema_init(&fc->outstanding, MAX_OUTSTANDING);
fc->reqctr = 1;
- fc->has_release = 1;
}
return fc;
}
static int fuse_release(struct inode *inode, struct file *file)
{
struct fuse_conn *fc = INO_FC(inode);
- struct fuse_in in = FUSE_IN_INIT;
- struct fuse_out out = FUSE_OUT_INIT;
+ struct fuse_in *in = NULL;
- if(!fc->has_release)
- return 0;
+ in = kmalloc(sizeof(struct fuse_in), GFP_NOFS);
+ if(!in)
+ return -ENOMEM;
- in.h.opcode = FUSE_RELEASE;
- in.h.ino = inode->i_ino;
- request_send(fc, &in, &out);
+ memset(in, 0, sizeof(struct fuse_in));
- if(out.h.error == -ENOSYS) {
- fc->has_release = 0;
+ in->h.opcode = FUSE_RELEASE;
+ in->h.ino = inode->i_ino;
+ if(!request_send_noreply(fc, in))
return 0;
- }
- return out.h.error;
+ kfree(in);
+ return 0;
}
/** The next unique request id */
int reqctr;
-
- /* Flag indicating whether the release call is supported */
- int has_release;
};
/** One input argument of a request */
static void do_release(struct fuse *f, struct fuse_in_header *in)
{
- int res;
char *path;
- res = -ENOENT;
path = get_path(f, in->ino);
if(path != NULL) {
- res = -ENOSYS;
if(f->op.release)
- res = f->op.release(path);
+ f->op.release(path);
free(path);
}
- send_reply(f, in, res, NULL, 0);
}
static void do_read(struct fuse *f, struct fuse_in_header *in,