#define ORANGEFS_CACHE_CREATE_FLAGS 0
#endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */
-#define ORANGEFS_CACHE_ALLOC_FLAGS (GFP_KERNEL)
#define ORANGEFS_GFP_FLAGS (GFP_KERNEL)
#define ORANGEFS_BUFMAP_GFP_FLAGS (GFP_KERNEL)
/*
* Set uses_shared_memory to 1 if this operation uses shared memory.
* If true, then a retry on the op must also get a new shared memory
- * buffer and re-populate it.
+ * buffer and re-populate it. Cancels don't care - it only matters
+ * for service_operation() retry logics and cancels don't go through
+ * it anymore.
*/
- int uses_shared_memory;
+ union {
+ int uses_shared_memory;
+ int slot_to_free;
+ };
struct orangefs_upcall_s upcall;
struct orangefs_downcall_s downcall;
wait_queue_head_t waitq;
spinlock_t lock;
- int io_completed;
- wait_queue_head_t io_completion_waitq;
+ struct completion done;
atomic_t ref_count;
/* VFS aio fields */
- /* used by the async I/O code to stash the orangefs_kiocb_s structure */
- void *priv;
-
int attempts;
struct list_head list;
#define set_op_state_waiting(op) ((op)->op_state = OP_VFS_STATE_WAITING)
#define set_op_state_inprogress(op) ((op)->op_state = OP_VFS_STATE_INPROGR)
+#define set_op_state_given_up(op) ((op)->op_state = OP_VFS_STATE_GIVEN_UP)
static inline void set_op_state_serviced(struct orangefs_kernel_op_s *op)
{
op->op_state = OP_VFS_STATE_SERVICED;
wake_up_interruptible(&op->waitq);
}
-static inline void set_op_state_purged(struct orangefs_kernel_op_s *op)
-{
- op->op_state |= OP_VFS_STATE_PURGED;
- wake_up_interruptible(&op->waitq);
-}
#define op_state_waiting(op) ((op)->op_state & OP_VFS_STATE_WAITING)
#define op_state_in_progress(op) ((op)->op_state & OP_VFS_STATE_INPROGR)
#define op_state_serviced(op) ((op)->op_state & OP_VFS_STATE_SERVICED)
#define op_state_purged(op) ((op)->op_state & OP_VFS_STATE_PURGED)
#define op_state_given_up(op) ((op)->op_state & OP_VFS_STATE_GIVEN_UP)
+#define op_is_cancel(op) ((op)->upcall.type == ORANGEFS_VFS_OP_CANCEL)
static inline void get_op(struct orangefs_kernel_op_s *op)
{
}
}
+extern void orangefs_bufmap_put(int);
+static inline void put_cancel(struct orangefs_kernel_op_s *op)
+{
+ orangefs_bufmap_put(op->slot_to_free);
+ op_release(op);
+}
+
+static inline void set_op_state_purged(struct orangefs_kernel_op_s *op)
+{
+ spin_lock(&op->lock);
+ if (unlikely(op_is_cancel(op))) {
+ list_del(&op->list);
+ spin_unlock(&op->lock);
+ put_cancel(op);
+ } else {
+ op->op_state |= OP_VFS_STATE_PURGED;
+ wake_up_interruptible(&op->waitq);
+ spin_unlock(&op->lock);
+ }
+}
+
/* per inode private orangefs info */
struct orangefs_inode_s {
struct orangefs_object_kref refn;
int op_cache_initialize(void);
int op_cache_finalize(void);
struct orangefs_kernel_op_s *op_alloc(__s32 type);
+void orangefs_new_tag(struct orangefs_kernel_op_s *op);
char *get_opname_string(struct orangefs_kernel_op_s *new_op);
-int dev_req_cache_initialize(void);
-int dev_req_cache_finalize(void);
-void *dev_req_alloc(void);
-void dev_req_release(void *);
-
int orangefs_inode_cache_initialize(void);
int orangefs_inode_cache_finalize(void);
-int kiocb_cache_initialize(void);
-int kiocb_cache_finalize(void);
-struct orangefs_kiocb_s *kiocb_alloc(void);
-void kiocb_release(struct orangefs_kiocb_s *ptr);
-
/*
* defined in orangefs-mod.c
*/
struct dentry *dentry,
struct kstat *kstat);
+int orangefs_permission(struct inode *inode, int mask);
+
/*
* defined in xattr.c
*/
int orangefs_dev_init(void);
void orangefs_dev_cleanup(void);
int is_daemon_in_service(void);
+bool __is_daemon_in_service(void);
int fs_mount_pending(__s32 fsid);
/*
size_t size,
int flags);
-int orangefs_inode_getattr(struct inode *inode, __u32 mask);
+int orangefs_inode_getattr(struct inode *inode, __u32 mask, int check);
int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
-void orangefs_op_initialize(struct orangefs_kernel_op_s *op);
-
void orangefs_make_bad_inode(struct inode *inode);
void orangefs_block_signals(sigset_t *);
int orangefs_unmount_sb(struct super_block *sb);
-int orangefs_cancel_op_in_progress(__u64 tag);
+bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
static inline __u64 orangefs_convert_time_field(const struct timespec *ts)
{
const char *op_name,
int flags);
-/*
- * handles two possible error cases, depending on context.
- *
- * by design, our vfs i/o errors need to be handled in one of two ways,
- * depending on where the error occured.
- *
- * if the error happens in the waitqueue code because we either timed
- * out or a signal was raised while waiting, we need to cancel the
- * userspace i/o operation and free the op manually. this is done to
- * avoid having the device start writing application data to our shared
- * bufmap pages without us expecting it.
- *
- * FIXME: POSSIBLE OPTIMIZATION:
- * However, if we timed out or if we got a signal AND our upcall was never
- * picked off the queue (i.e. we were in OP_VFS_STATE_WAITING), then we don't
- * need to send a cancellation upcall. The way we can handle this is
- * set error_exit to 2 in such cases and 1 whenever cancellation has to be
- * sent and have handle_error
- * take care of this situation as well..
- *
- * if a orangefs sysint level error occured and i/o has been completed,
- * there is no need to cancel the operation, as the user has finished
- * using the bufmap page and so there is no danger in this case. in
- * this case, we wake up the device normally so that it may free the
- * op, as normal.
- *
- * note the only reason this is a macro is because both read and write
- * cases need the exact same handling code.
- */
-#define handle_io_error() \
-do { \
- if (!op_state_serviced(new_op)) { \
- orangefs_cancel_op_in_progress(new_op->tag); \
- } else { \
- wake_up_daemon_for_return(new_op); \
- } \
- orangefs_bufmap_put(bufmap, buffer_index); \
- buffer_index = -1; \
-} while (0)
-
#define get_interruptible_flag(inode) \
((ORANGEFS_SB(inode->i_sb)->flags & ORANGEFS_OPT_INTR) ? \
ORANGEFS_OP_INTERRUPTIBLE : 0)