[PVFS2-CVS]
commit by neill in pvfs2-1/src/kernel/linux-2.6: pvfs2-kernel.h
pvfs2-utils.c waitqueue.c
CVS commit program
cvs at parl.clemson.edu
Thu Mar 4 16:21:15 EST 2004
Update of /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6
In directory parlweb:/tmp/cvs-serv29802/src/kernel/linux-2.6
Modified Files:
pvfs2-kernel.h pvfs2-utils.c waitqueue.c
Log Message:
- support ignoring non-fatal signals received by the calling process during
a remote operation as the default mount behaviour. use mount option intr
to allow ANY signal to interrupt the calling process. (similar to nfs)
- NOTE: during a remote operation, it may take up to
MAX_SERVICE_WAIT_IN_SECONDS (30 seconds by default) to realize a SIGINT
or SIGQUIT signal has been received. SIGKILL always aborts immediately.
- some misc re-organization
Index: pvfs2-kernel.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-kernel.h,v
diff -p -u -r1.39 -r1.40
--- pvfs2-kernel.h 3 Mar 2004 23:11:08 -0000 1.39
+++ pvfs2-kernel.h 4 Mar 2004 21:21:15 -0000 1.40
@@ -148,10 +148,9 @@ typedef struct
sb private info, but this is mostly for compatibility in case one
day these are not passed as mount options.
- the intr option is inspired by the nfs intr option that interrupts
- the operation in progress if a signal is received if set, and
- ignores the signal otherwise.
- FIXME: THIS IS NOT YET SUPPORTED.
+ the intr option (if set) is inspired by the nfs intr option that
+ interrupts the operation in progress if a signal is received, and
+ ignores the signal otherwise (if not set).
*/
typedef struct
{
@@ -184,6 +183,96 @@ static inline pvfs2_sb_info *PVFS2_SB(
return (pvfs2_sb_info *)sb->s_fs_info;
}
+/****************************
+ * defined in pvfs2-cache.c
+ ****************************/
+void op_cache_initialize(
+ void);
+void op_cache_finalize(
+ void);
+void op_release(
+ void *op);
+void dev_req_cache_initialize(
+ void);
+void dev_req_cache_finalize(
+ void);
+void pvfs2_inode_cache_initialize(
+ void);
+void pvfs2_inode_cache_finalize(
+ void);
+
+/****************************
+ * defined in waitqueue.c
+ ****************************/
+int wait_for_matching_downcall(
+ pvfs2_kernel_op_t * op);
+
+/****************************
+ * defined in inode.c
+ ****************************/
+int pvfs2_setattr(
+ struct dentry *dentry,
+ struct iattr *iattr);
+
+/****************************
+ * defined in namei.c
+ ****************************/
+struct dentry *pvfs2_lookup(
+ struct inode *dir,
+ struct dentry *dentry,
+ struct nameidata *nd);
+
+int pvfs2_empty_dir(
+ struct dentry *dentry);
+
+/****************************
+ * defined in pvfs2-utils.c
+ ****************************/
+int pvfs2_gen_credentials(
+ PVFS_credentials *credentials);
+
+int pvfs2_inode_getattr(
+ struct inode *inode);
+
+int pvfs2_inode_setattr(
+ struct inode *inode,
+ struct iattr *iattr);
+
+struct inode *pvfs2_create_entry(
+ struct inode *dir,
+ struct dentry *dentry,
+ const char *symname,
+ int mode,
+ int op_type,
+ int *error_code);
+
+int pvfs2_remove_entry(
+ struct inode *dir,
+ struct dentry *dentry);
+
+int pvfs2_truncate_inode(
+ struct inode *inode,
+ loff_t size);
+
+int pvfs2_kernel_error_code_convert(
+ int pvfs2_error_code);
+
+void pvfs2_inode_initialize(
+ pvfs2_inode_t *pvfs2_inode);
+
+void pvfs2_op_initialize(
+ pvfs2_kernel_op_t *op);
+
+void pvfs2_make_bad_inode(
+ struct inode *inode);
+
+void mask_blocked_signals(
+ sigset_t *orig_sigset);
+
+void unmask_blocked_signals(
+ sigset_t *orig_sigset);
+
+
/************************************
* misc convenience macros
************************************/
@@ -222,46 +311,56 @@ do {
&(op->tag)); \
} while(0)
-#define service_operation(op, method, intr) \
-add_op_to_request_list(op); \
-ret = wait_for_matching_downcall(new_op, intr); \
-if (ret != PVFS2_WAIT_SUCCESS) \
-{ \
- if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
- { \
- pvfs2_error("pvfs2: %s -- wait timed out (%x). " \
- "aborting attempt.\n", method,ret); \
- } \
- goto error_exit; \
-}
+#define service_operation(op, method, intr) \
+do { \
+ sigset_t orig_sigset; \
+ if (!intr) mask_blocked_signals(&orig_sigset); \
+ add_op_to_request_list(op); \
+ ret = wait_for_matching_downcall(new_op); \
+ if (!intr) unmask_blocked_signals(&orig_sigset); \
+ if (ret != PVFS2_WAIT_SUCCESS) \
+ { \
+ if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
+ { \
+ pvfs2_error("pvfs2: %s -- wait timed out (%x). " \
+ "aborting attempt.\n", method,ret); \
+ } \
+ goto error_exit; \
+ } \
+} while(0)
/*
tries to service the operation and will retry on timeout
failure up to num times (num MUST be a numeric lvalue).
*/
-#define service_operation_with_timeout_retry(op, method, num, intr)\
-wait_for_op: \
- add_op_to_request_list(op); \
- ret = wait_for_matching_downcall(op, intr); \
- if (ret != PVFS2_WAIT_SUCCESS) \
- { \
- if ((ret == PVFS2_WAIT_TIMEOUT_REACHED) && (--num)) \
- { \
- pvfs2_print("pvfs2: %s -- timeout; requeing op\n", \
- method); \
- goto wait_for_op; \
- } \
- else \
- { \
- if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
- { \
- pvfs2_error("pvfs2: %s -- wait timed out (%x). " \
- "aborting retry attempts.\n", \
- method,ret); \
- } \
- goto error_exit; \
- } \
- }
+#define service_operation_with_timeout_retry(op, method, num, intr) \
+do { \
+ sigset_t orig_sigset; \
+ if (!intr) mask_blocked_signals(&orig_sigset); \
+ wait_for_op: \
+ add_op_to_request_list(op); \
+ ret = wait_for_matching_downcall(op); \
+ if (!intr) unmask_blocked_signals(&orig_sigset); \
+ if (ret != PVFS2_WAIT_SUCCESS) \
+ { \
+ if ((ret == PVFS2_WAIT_TIMEOUT_REACHED) && (--num)) \
+ { \
+ pvfs2_print("pvfs2: %s -- timeout; requeing op\n", \
+ method); \
+ goto wait_for_op; \
+ } \
+ else \
+ { \
+ if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
+ { \
+ pvfs2_error("pvfs2: %s -- wait timed out (%x). " \
+ "aborting retry attempts.\n", \
+ method,ret); \
+ } \
+ goto error_exit; \
+ } \
+ } \
+} while(0)
/*
tries to service the operation and will retry on timeout
@@ -273,30 +372,35 @@ wait_for_op:
NOTE: used in namei.c:lookup, file.c:pvfs2_inode_read, and
file.c:pvfs2_file_write
*/
-#define service_error_exit_op_with_timeout_retry(op,meth,num,e, intr)\
-wait_for_op: \
- add_op_to_request_list(op); \
- ret = wait_for_matching_downcall(op, intr); \
- if (ret != PVFS2_WAIT_SUCCESS) \
- { \
- if ((ret == PVFS2_WAIT_TIMEOUT_REACHED) && (--num)) \
- { \
- pvfs2_print("pvfs2: %s -- timeout; requeing op\n", \
- meth); \
- goto wait_for_op; \
- } \
- else \
- { \
- if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
- { \
- pvfs2_error("pvfs2: %s -- wait timed out (%x). " \
- "aborting retry attempts.\n", \
- meth,ret); \
- } \
- e = 1; \
- goto error_exit; \
- } \
- }
+#define service_error_exit_op_with_timeout_retry(op,meth,num,e, intr) \
+do { \
+ sigset_t orig_sigset; \
+ if (!intr) mask_blocked_signals(&orig_sigset); \
+ wait_for_op: \
+ add_op_to_request_list(op); \
+ ret = wait_for_matching_downcall(op); \
+ if (!intr) unmask_blocked_signals(&orig_sigset); \
+ if (ret != PVFS2_WAIT_SUCCESS) \
+ { \
+ if ((ret == PVFS2_WAIT_TIMEOUT_REACHED) && (--num)) \
+ { \
+ pvfs2_print("pvfs2: %s -- timeout; requeing op\n", \
+ meth); \
+ goto wait_for_op; \
+ } \
+ else \
+ { \
+ if (ret == PVFS2_WAIT_TIMEOUT_REACHED) \
+ { \
+ pvfs2_error("pvfs2: %s -- wait timed out (%x). " \
+ "aborting retry attempts.\n", \
+ meth,ret); \
+ } \
+ e = 1; \
+ goto error_exit; \
+ } \
+ } \
+} while(0)
/*
by design, our vfs i/o errors need to be handled in one of two ways,
@@ -323,14 +427,14 @@ wait_for_op:
do { \
if (error_exit) \
{ \
- ret = -EIO; \
+ ret = -EINTR; \
kill_device_owner(); \
op_release(new_op); \
} \
else \
{ \
ret = ((new_op->downcall.status == -PVFS_ENOENT) ? \
- -ENOENT : -EIO); \
+ -ENOENT : -EINTR); \
*offset = original_offset; \
wake_up_device_for_return(new_op); \
} \
@@ -341,88 +445,6 @@ do {
#define get_interruptible_flag(inode) \
(PVFS2_SB(inode->i_sb)->mnt_options.intr)
-/****************************
- * defined in pvfs2-cache.c
- ****************************/
-void op_cache_initialize(
- void);
-void op_cache_finalize(
- void);
-void op_release(
- void *op);
-void dev_req_cache_initialize(
- void);
-void dev_req_cache_finalize(
- void);
-void pvfs2_inode_cache_initialize(
- void);
-void pvfs2_inode_cache_finalize(
- void);
-
-/****************************
- * defined in waitqueue.c
- ****************************/
-int wait_for_matching_downcall(
- pvfs2_kernel_op_t * op, int interruptible);
-
-/****************************
- * defined in inode.c
- ****************************/
-int pvfs2_setattr(
- struct dentry *dentry,
- struct iattr *iattr);
-
-/****************************
- * defined in namei.c
- ****************************/
-struct dentry *pvfs2_lookup(
- struct inode *dir,
- struct dentry *dentry,
- struct nameidata *nd);
-
-int pvfs2_empty_dir(
- struct dentry *dentry);
-
-/****************************
- * defined in pvfs2-utils.c
- ****************************/
-int pvfs2_gen_credentials(
- PVFS_credentials *credentials);
-
-int pvfs2_inode_getattr(
- struct inode *inode);
-
-int pvfs2_inode_setattr(
- struct inode *inode,
- struct iattr *iattr);
-
-struct inode *pvfs2_create_entry(
- struct inode *dir,
- struct dentry *dentry,
- const char *symname,
- int mode,
- int op_type,
- int *error_code);
-
-int pvfs2_remove_entry(
- struct inode *dir,
- struct dentry *dentry);
-
-int pvfs2_truncate_inode(
- struct inode *inode,
- loff_t size);
-
-int pvfs2_kernel_error_code_convert(
- int pvfs2_error_code);
-
-void pvfs2_inode_initialize(
- pvfs2_inode_t *pvfs2_inode);
-
-void pvfs2_op_initialize(
- pvfs2_kernel_op_t *op);
-
-void pvfs2_make_bad_inode(
- struct inode *inode);
#endif /* __PVFS2KERNEL_H */
Index: pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-utils.c,v
diff -p -u -r1.54 -r1.55
--- pvfs2-utils.c 3 Mar 2004 23:11:08 -0000 1.54
+++ pvfs2-utils.c 4 Mar 2004 21:21:15 -0000 1.55
@@ -973,6 +973,36 @@ void pvfs2_make_bad_inode(struct inode *
make_bad_inode(inode);
}
+/* this code is based on linux/net/sunrpc/clnt.c:rpc_clnt_sigmask */
+void mask_blocked_signals(sigset_t *orig_sigset)
+{
+ unsigned long sigallow = sigmask(SIGKILL);
+ unsigned long irqflags = 0;
+ struct k_sigaction *action = current->sighand->action;
+
+ sigallow |= ((action[SIGINT-1].sa.sa_handler == SIG_DFL) ?
+ sigmask(SIGINT) : 0);
+ sigallow |= ((action[SIGQUIT-1].sa.sa_handler == SIG_DFL) ?
+ sigmask(SIGQUIT) : 0);
+
+ spin_lock_irqsave(¤t->sighand->siglock, irqflags);
+ *orig_sigset = current->blocked;
+ siginitsetinv(¤t->blocked, sigallow & ~orig_sigset->sig[0]);
+ recalc_sigpending();
+ spin_unlock_irqrestore(¤t->sighand->siglock, irqflags);
+}
+
+/* this code is based on linux/net/sunrpc/clnt.c:rpc_clnt_sigunmask */
+void unmask_blocked_signals(sigset_t *orig_sigset)
+{
+ unsigned long irqflags = 0;
+
+ spin_lock_irqsave(¤t->sighand->siglock, irqflags);
+ current->blocked = *orig_sigset;
+ recalc_sigpending();
+ spin_unlock_irqrestore(¤t->sighand->siglock, irqflags);
+}
+
/*
* Local variables:
* c-indent-level: 4
Index: waitqueue.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/waitqueue.c,v
diff -p -u -r1.9 -r1.10
--- waitqueue.c 3 Mar 2004 23:11:08 -0000 1.9
+++ waitqueue.c 4 Mar 2004 21:21:15 -0000 1.10
@@ -74,14 +74,8 @@ static inline void clean_up_interrupted_
PVFS2_WAIT_SIGNAL_RECVD
- sleep interrupted (signal recv'd) the op observes no state
change.
-
- if the 'interruptible' flag is set, the operation will be
- interrupted on any signal received by the calling process. if it
- is NOT set, we interrupt only on SIGINT, SIGQUIT, and SIGKILL.
- FIXME: THIS IS NOT YET SUPPORTED.
*/
-int wait_for_matching_downcall(
- pvfs2_kernel_op_t * op, int interruptible)
+int wait_for_matching_downcall(pvfs2_kernel_op_t * op)
{
int ret = PVFS2_WAIT_ERROR;
DECLARE_WAITQUEUE(wait_entry, current);
More information about the PVFS2-CVS
mailing list