From 19ae3c0349c272f97f201eeffe5969469c401a39 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 6 Oct 2003 22:31:54 +0000 Subject: [PATCH] Merge most b_llp_hp features and fixes into b_devel: - some functional LDLM reorganization to support posix flocks - new posix flock code added, but not yet enabled in llite/ - kernel patches for NFS export and ext3 raw lookup - NFS export enabled, ext3 raw lookup not enabled - includes all LDLM patches from bug 1766 - locking to fix unlink/create inode re-use recovery race - added /proc tunables for pre-creation variables --- lnet/include/linux/kp30.h | 2 +- lustre/kernel_patches/patches/ext3-raw-lookup.patch | 2 +- lustre/ldlm/ldlm_internal.h | 20 ++++++++++++++++++++ lustre/ldlm/ldlm_lib.c | 6 ++++-- lustre/llite/llite_internal.h | 7 +++++-- lustre/lov/lov_internal.h | 4 ++-- lustre/portals/include/linux/kp30.h | 2 +- lustre/ptlrpc/pinger.c | 3 ++- lustre/tests/replay-single.sh | 10 +++++----- lustre/utils/wirecheck.c | 15 +++++++++++++-- 10 files changed, 54 insertions(+), 17 deletions(-) diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 5421807..6f31b9f 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -58,7 +58,7 @@ extern unsigned int portal_cerror; #define D_IOCTL (1 << 7) /* ioctl related information */ #define D_BLOCKS (1 << 8) /* ext2 block allocation */ #define D_NET (1 << 9) /* network communications */ -#define D_WARNING (1 << 10) +#define D_WARNING (1 << 10) /* CWARN(...) == CDEBUG (D_WARNING, ...) */ #define D_BUFFS (1 << 11) #define D_OTHER (1 << 12) #define D_DENTRY (1 << 13) diff --git a/lustre/kernel_patches/patches/ext3-raw-lookup.patch b/lustre/kernel_patches/patches/ext3-raw-lookup.patch index 5df509a..216accc 100644 --- a/lustre/kernel_patches/patches/ext3-raw-lookup.patch +++ b/lustre/kernel_patches/patches/ext3-raw-lookup.patch @@ -26,7 +26,7 @@ + struct dentry parent; + struct dentry dentry; + -+ if (len < EXT3_NAME_LEN) ++ if (len > EXT3_NAME_LEN) + return -ENAMETOOLONG; + + parent.d_inode = dir; diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index 5aca55f..e16686c 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -11,3 +11,23 @@ ldlm_lock_create(struct ldlm_namespace *ns, ldlm_completion_callback, void *data); ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **, void *cookie, int cookie_len, int *flags); +void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode); +void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode); +void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, + void *data, int datalen); +int ldlm_reprocess_queue(struct ldlm_resource *res, struct list_head *queue); + +typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, int *flags, + int first_enq, ldlm_error_t *err); + +/* ldlm_plain.c */ +int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq, + ldlm_error_t *err); + +/* ldlm_extent.c */ +int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq, + ldlm_error_t *err); + +/* ldlm_flock.c */ +int ldlm_process_flock_lock(struct ldlm_lock *lock, int *flags, int first_enq, + ldlm_error_t *err); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 8d92a64..7dd2834 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -483,7 +483,8 @@ static void reset_recovery_timer(struct obd_device *obd) if (!recovering) return; - CERROR("timer will expire in %d seconds\n", OBD_RECOVERY_TIMEOUT / HZ); + CDEBUG(D_HA, "timer will expire in %u seconds\n", + OBD_RECOVERY_TIMEOUT / HZ); mod_timer(&obd->obd_recovery_timer, jiffies + OBD_RECOVERY_TIMEOUT); } @@ -496,7 +497,8 @@ void target_start_recovery_timer(struct obd_device *obd, svc_handler_t handler) spin_unlock_bh(&obd->obd_processing_task_lock); return; } - CERROR("%s: starting recovery timer\n", obd->obd_name); + CERROR("%s: starting recovery timer (%us)\n", obd->obd_name, + OBD_RECOVERY_TIMEOUT / HZ); obd->obd_recovery_handler = handler; obd->obd_recovery_timer.function = target_recovery_expired; obd->obd_recovery_timer.data = (unsigned long)obd; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 50dfaea..1586aa9 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -158,8 +158,11 @@ int ll_iocontrol(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); void ll_umount_begin(struct super_block *sb); int ll_prep_inode(struct obd_export *exp, struct inode **inode, - struct ptlrpc_request *req, int offset, struct super_block *sb); - + struct ptlrpc_request *req, int offset, struct super_block *); +__u32 get_uuid2int(const char *name, int len); +struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len, + int fhtype, int parent); +int ll_dentry_to_fh(struct dentry *, __u32 *datap, int *lenp, int need_parent); /* llite/symlink.c */ extern struct inode_operations ll_fast_symlink_inode_operations; diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index bd303b6..07df1c2 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -29,9 +29,9 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm, int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsm, struct lov_mds_md *lmm, int lmmsize); int lov_setstripe(struct obd_export *exp, - struct lov_stripe_md **lsmp, struct lov_mds_md *lmmu); + struct lov_stripe_md **lsmp, struct lov_mds_md *lump); int lov_getstripe(struct obd_export *exp, - struct lov_stripe_md *lsm, struct lov_mds_md *lmmu); + struct lov_stripe_md *lsm, struct lov_mds_md *lump); /* lproc_lov.c */ extern struct file_operations lov_proc_target_fops; diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 5421807..6f31b9f 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -58,7 +58,7 @@ extern unsigned int portal_cerror; #define D_IOCTL (1 << 7) /* ioctl related information */ #define D_BLOCKS (1 << 8) /* ext2 block allocation */ #define D_NET (1 << 9) /* network communications */ -#define D_WARNING (1 << 10) +#define D_WARNING (1 << 10) /* CWARN(...) == CDEBUG (D_WARNING, ...) */ #define D_BUFFS (1 << 11) #define D_OTHER (1 << 12) #define D_DENTRY (1 << 13) diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 19481fa..d972076 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -129,7 +129,8 @@ static int ptlrpc_pinger_main(void *arg) while (1) { unsigned long this_ping = jiffies; long time_to_next_ping; - struct l_wait_info lwi = LWI_TIMEOUT(10 * HZ, NULL, NULL); + struct l_wait_info lwi = LWI_TIMEOUT(obd_timeout * HZ, + NULL, NULL); struct ptlrpc_request_set *set; struct ptlrpc_request *req; struct list_head *iter; diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 4b69c89..37daa31 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -237,7 +237,7 @@ test_12() { multiop $DIR/$tfile o_tSc & pid=$! # give multiop a chance to open - sleep 1 + sleep 1 rm -f $DIR/$tfile replay_barrier mds kill -USR1 $pid @@ -308,12 +308,12 @@ run_test 15 "open(O_CREAT), unlink |X| touch new, close" test_16() { replay_barrier mds mcreate $DIR/$tfile - unlink $DIR/$tfile + munlink $DIR/$tfile mcreate $DIR/$tfile-2 fail mds [ -e $DIR/$tfile ] && return 1 [ -e $DIR/$tfile-2 ] || return 2 - unlink $DIR/$tfile-2 || return 3 + munlink $DIR/$tfile-2 || return 3 } run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new" @@ -347,8 +347,8 @@ test_18() { [ -e $DIR/$tfile-2 ] || return 4 # this touch frequently fails touch $DIR/$tfile-3 || return 5 - unlink $DIR/$tfile-2 || return 6 - unlink $DIR/$tfile-3 || return 7 + munlink $DIR/$tfile-2 || return 6 + munlink $DIR/$tfile-3 || return 7 return 0 } run_test 18 "|X| open(O_CREAT), unlink, touch new, close, touch, unlink" diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index c1e7995..27c6aab 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -328,6 +328,16 @@ check_ldlm_extent (void) } void +check_ldlm_flock (void) +{ + BLANK_LINE (); + CHECK_STRUCT (ldlm_flock); + CHECK_MEMBER (ldlm_flock, start); + CHECK_MEMBER (ldlm_flock, end); + CHECK_MEMBER (ldlm_flock, pid); +} + +void check_ldlm_intent (void) { BLANK_LINE (); @@ -353,7 +363,7 @@ check_ldlm_lock_desc (void) CHECK_MEMBER (ldlm_lock_desc, l_resource); CHECK_MEMBER (ldlm_lock_desc, l_req_mode); CHECK_MEMBER (ldlm_lock_desc, l_granted_mode); - CHECK_MEMBER (ldlm_lock_desc, l_extent); + CHECK_MEMBER (ldlm_lock_desc, l_policy_data); CHECK_MEMBER (ldlm_lock_desc, l_version[RES_VERSION_SIZE]); } @@ -377,7 +387,7 @@ check_ldlm_reply (void) CHECK_MEMBER (ldlm_reply, lock_mode); CHECK_MEMBER (ldlm_reply, lock_resource_name); CHECK_MEMBER (ldlm_reply, lock_handle); - CHECK_MEMBER (ldlm_reply, lock_extent); + CHECK_MEMBER (ldlm_reply, lock_policy_data); CHECK_MEMBER (ldlm_reply, lock_policy_res1); CHECK_MEMBER (ldlm_reply, lock_policy_res2); } @@ -571,6 +581,7 @@ main (int argc, char **argv) check_lov_desc (); check_ldlm_res_id (); check_ldlm_extent (); + check_ldlm_flock (); check_ldlm_intent (); check_ldlm_resource_desc (); check_ldlm_lock_desc (); -- 1.8.3.1