From 4ba34ceb000ef2a634c86878e84a4b81a3cd148e Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 23 Nov 2005 03:09:35 +0000 Subject: [PATCH] b=8007 update from b1_4 --- .../patches/ext3-mballoc2-2.6-suse.patch | 30 +- .../patches/ext3-mballoc2-2.6.9-rhel4.patch | 30 +- lustre/ChangeLog | 99 ++++++ lustre/autoconf/lustre-core.m4 | 1 + lustre/autoconf/lustre-version.ac | 32 +- lustre/include/linux/Makefile.am | 2 +- lustre/include/linux/lustre_cfg.h | 7 +- lustre/include/linux/lustre_idl.h | 134 ++++----- lustre/include/linux/lustre_import.h | 1 + lustre/include/linux/lustre_lib.h | 287 +++++++++--------- lustre/include/linux/lustre_lite.h | 53 ++++ lustre/include/linux/lustre_log.h | 4 +- lustre/include/linux/lustre_mds.h | 2 +- lustre/include/linux/lustre_ver.h.in | 23 ++ lustre/include/linux/obd.h | 162 +++++----- lustre/include/linux/obd_class.h | 60 +++- lustre/include/linux/obd_ost.h | 5 +- .../patches/ext3-mballoc2-2.6-suse.patch | 30 +- .../patches/ext3-mballoc2-2.6.9-rhel4.patch | 30 +- lustre/ldlm/ldlm_lib.c | 132 ++++---- lustre/ldlm/ldlm_lock.c | 5 +- lustre/ldlm/ldlm_lockd.c | 58 +++- lustre/liblustre/file.c | 19 +- lustre/liblustre/llite_lib.c | 13 +- lustre/liblustre/llite_lib.h | 26 +- lustre/liblustre/rw.c | 53 ++-- lustre/liblustre/super.c | 103 ++++--- lustre/llite/llite_internal.h | 2 +- lustre/llite/llite_lib.c | 22 +- lustre/llite/rw.c | 4 +- lustre/lov/lov_obd.c | 214 +++++++++---- lustre/lov/lov_pack.c | 4 +- lustre/lvfs/lvfs_linux.c | 20 ++ lustre/mdc/mdc_request.c | 30 +- lustre/mds/handler.c | 168 ++++++++--- lustre/mds/mds_fs.c | 28 ++ lustre/mds/mds_internal.h | 11 +- lustre/mds/mds_lib.c | 2 + lustre/mds/mds_lov.c | 48 ++- lustre/mds/mds_open.c | 8 +- lustre/mds/mds_reint.c | 23 +- lustre/obdclass/class_obd.c | 1 + lustre/obdclass/lprocfs_status.c | 1 + lustre/obdclass/lustre_handles.c | 34 ++- lustre/obdclass/obd_config.c | 45 ++- lustre/obdclass/obd_mount.c | 2 +- lustre/obdfilter/filter.c | 113 +++++-- lustre/obdfilter/filter_internal.h | 2 + lustre/obdfilter/filter_io.c | 14 +- lustre/osc/osc_request.c | 123 ++++++-- lustre/ost/ost_handler.c | 139 ++++++++- lustre/ptlrpc/import.c | 67 ++++- lustre/ptlrpc/lproc_ptlrpc.c | 6 - lustre/ptlrpc/pack_generic.c | 334 +++++++++++++-------- lustre/ptlrpc/ptlrpc_internal.h | 10 +- lustre/ptlrpc/ptlrpc_module.c | 3 - lustre/tests/conf-sanity.sh | 11 + lustre/tests/insanity.sh | 2 +- lustre/utils/Makefile.am | 4 +- lustre/utils/lconf | 5 +- lustre/utils/lfs.c | 2 +- lustre/utils/llog_reader.c | 45 +-- lustre/utils/wirecheck.c | 194 ++++++------ lustre/utils/wiretest.c | 242 ++++++++++----- 64 files changed, 2272 insertions(+), 1112 deletions(-) create mode 100644 lustre/include/linux/lustre_ver.h.in diff --git a/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch b/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch index 31e7e38..6a6cf7c 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch @@ -446,31 +446,31 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c +static inline int mb_test_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ return ext2_test_bit(bit, addr); ++ return ext3_test_bit(bit, addr); +} + +static inline void mb_set_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit(bit, addr); ++ ext3_set_bit(bit, addr); +} + +static inline void mb_set_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit_atomic(NULL, bit, addr); ++ ext3_set_bit_atomic(NULL, bit, addr); +} + +static inline void mb_clear_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit(bit, addr); ++ ext3_clear_bit(bit, addr); +} + +static inline void mb_clear_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit_atomic(NULL, bit, addr); ++ ext3_clear_bit_atomic(NULL, bit, addr); +} + +static inline void *mb_find_buddy(struct ext3_buddy *e3b, int order, int *max) @@ -1015,7 +1015,7 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c + i = e3b->bd_bd->bb_first_free; + + while (free && ac->ac_status != AC_STATUS_FOUND) { -+ i = ext2_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); ++ i = ext3_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); + if (i >= sb->s_blocksize * 8) { + J_ASSERT(free == 0); + break; @@ -1205,13 +1205,13 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c + + if (ac.ac_status == AC_STATUS_BREAK && + !(ac.ac_flags & EXT3_MB_HINT_FIRST)) { -+ /* -+ * We've been searching too long. Let's try to allocate -+ * the best chunk we've found so far -+ */ -+ ext3_warning(inode->i_sb, __FUNCTION__, -+ "too long searching: got %d want %d\n", -+ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); ++ /* We've been searching too long. Let's try to allocate ++ * the best chunk we've found so far. */ ++ if (ac.ac_g_ex.fe_len >= 128 && ++ ac.ac_b_ex.fe_len < ac.ac_g_ex.fe_len / 4) ++ ext3_warning(inode->i_sb, __FUNCTION__, ++ "too long searching: got %d want %d\n", ++ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); + ext3_mb_try_best_found(&ac, &e3b); + if (ac.ac_status != AC_STATUS_FOUND) { + /* @@ -1219,7 +1219,7 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c + * The only thing we can do is just take first + * found block(s) + */ -+ printk(KERN_ERR "EXT3-fs: and someone won our chunk\n"); ++ mb_debug(KERN_ERR "EXT3-fs: and someone won our chunk\n"); + ac.ac_b_ex.fe_group = 0; + ac.ac_b_ex.fe_start = 0; + ac.ac_b_ex.fe_len = 0; @@ -2413,7 +2413,7 @@ Index: linux-2.6.5-7.201/fs/ext3/super.c {Opt_extents, "extents"}, {Opt_extdebug, "extdebug"}, + {Opt_mballoc, "mballoc"}, -+ {Opt_mballoc, "mbfactor=%u"}, ++ {Opt_mbfactor, "mbfactor=%u"}, {Opt_err, NULL} }; diff --git a/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch b/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch index b3d9f73..3e1bafe 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch @@ -463,31 +463,31 @@ Index: linux-2.6.9/fs/ext3/mballoc.c +static inline int mb_test_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ return ext2_test_bit(bit, addr); ++ return ext3_test_bit(bit, addr); +} + +static inline void mb_set_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit(bit, addr); ++ ext3_set_bit(bit, addr); +} + +static inline void mb_set_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit_atomic(NULL, bit, addr); ++ ext3_set_bit_atomic(NULL, bit, addr); +} + +static inline void mb_clear_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit(bit, addr); ++ ext3_clear_bit(bit, addr); +} + +static inline void mb_clear_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit_atomic(NULL, bit, addr); ++ ext3_clear_bit_atomic(NULL, bit, addr); +} + +static inline void *mb_find_buddy(struct ext3_buddy *e3b, int order, int *max) @@ -1032,7 +1032,7 @@ Index: linux-2.6.9/fs/ext3/mballoc.c + i = e3b->bd_bd->bb_first_free; + + while (free && ac->ac_status != AC_STATUS_FOUND) { -+ i = ext2_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); ++ i = ext3_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); + if (i >= sb->s_blocksize * 8) { + J_ASSERT(free == 0); + break; @@ -1222,13 +1222,13 @@ Index: linux-2.6.9/fs/ext3/mballoc.c + + if (ac.ac_status == AC_STATUS_BREAK && + !(ac.ac_flags & EXT3_MB_HINT_FIRST)) { -+ /* -+ * We've been searching too long. Let's try to allocate -+ * the best chunk we've found so far -+ */ -+ ext3_warning(inode->i_sb, __FUNCTION__, -+ "too long searching: got %d want %d\n", -+ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); ++ /* We've been searching too long. Let's try to allocate ++ * the best chunk we've found so far. */ ++ if (ac.ac_g_ex.fe_len >= 128 && ++ ac.ac_b_ex.fe_len < ac.ac_g_ex.fe_len / 4) ++ ext3_warning(inode->i_sb, __FUNCTION__, ++ "too long searching: got %d want %d\n", ++ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); + ext3_mb_try_best_found(&ac, &e3b); + if (ac.ac_status != AC_STATUS_FOUND) { + /* @@ -1236,7 +1236,7 @@ Index: linux-2.6.9/fs/ext3/mballoc.c + * The only thing we can do is just take first + * found block(s) + */ -+ printk(KERN_ERR "EXT3-fs: and someone won our chunk\n"); ++ mb_debug(KERN_ERR "EXT3-fs: and someone won our chunk\n"); + ac.ac_b_ex.fe_group = 0; + ac.ac_b_ex.fe_start = 0; + ac.ac_b_ex.fe_len = 0; @@ -2428,7 +2428,7 @@ Index: linux-2.6.9/fs/ext3/super.c {Opt_extents, "extents"}, {Opt_extdebug, "extdebug"}, + {Opt_mballoc, "mballoc"}, -+ {Opt_mballoc, "mbfactor=%u"}, ++ {Opt_mbfactor, "mbfactor=%u"}, {Opt_barrier, "barrier=%u"}, {Opt_err, NULL}, {Opt_resize, "resize"}, diff --git a/lustre/ChangeLog b/lustre/ChangeLog index bad191f..bcf5758 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,4 +1,74 @@ tbd Cluster File Systems, Inc. + * version 1.4.7 + +Severity : minor +Frequency : occasional (Cray XT3 only) +Bugzilla : 7305 +Description: root not authorized to access files in CRAY_PORTALS environment +Details : The client process capabilities were not honoured on the MDS in + a CRAY_PORTALS/CRAY_XT3 environment. If the file had previously + been accessed by an authorized user then root was able to access + the file on the local client also. The root user capabilities + are now allowed on the MDS, as this environment has secure UID. + +Severity : minor +Frequency : occasional +Bugzilla : 6449 +Description: ldiskfs "too long searching" message happens too often +Details : A debugging message (otherwise harmless) prints too often on + the OST console. This has been reduced to only happen when + there are fragmentation problems on the filesystem. + +Severity : minor +Frequency : rare +Bugzilla : 9598 +Description: Division by zero in statfs when all OSCs are inactive +Details : lov_get_stripecnt() returns zero due to incorrect order of checks, + lov_statfs divides by value returned by lov_get_stripecnt(). + +Severity : minor +Frequency : common +Bugzilla : 9489, 3273 +Description: First write from each client to each OST was only 4kB in size, + to initialize client writeback cache, which caused sub-optimal + RPCs and poor layout on disk for the first writen file. +Details : Clients now request an initial cache grant at (re)connect time + and so that they can start streaming writes to the cache right + away and always do full-sized RPCs if there is enough data. + If the OST is rebooted the client also re-establishes its grant + so that client cached writes will be honoured under the grant. + +Severity : minor +Frequency : common +Bugzilla : 7198 +Description: Slow ls (and stat(2) syscall) on files residing on IO-loaded OSTs +Details : Now I/O RPCs go to different portal number and (presumably) fast + lock requests (and glimses) and other RPCs get their own service + threads pool that should be able to service those RPCs + immediatelly. + +Severity : enhancement +Bugzilla : 7417 +Description: Ability to exchange lustre version between client and servers and + issue warnings at client side if client is too old. Also for + liblustre clients there is ability to refuse connection of too old + clients. +Details : New 'version' field is added to connect data structure that is + filled with version info. That info is later checked by server and + by client. + +Severity : minor +Frequency : rare, liblustre only. +Bugzilla : 7198 +Description: Two simultaneous writes from liblustre at offset within same page + might proceed at the same time overwriting eachother with stale + data. +Details : I/O lock withing llu_file_prwv was released too early, before data + actually was hitting the wire. Extended lock-holding time until + server acknowledges receiving data. + + +tbd Cluster File Systems, Inc. * version 1.4.6 * WIRE PROTOCOL CHANGE. This version of Lustre networking WILL NOT INTEROPERATE with older versions automatically. Please read the @@ -268,6 +338,35 @@ Details : lconf --force (implied by --failover) sets the global obd_timeout other RPCs to time out too quickly. Do not change the global obd_timeout for force cleanup, only set it for DISCONNECT RPCs. +Severity : enhancement +Frequency : if MDS is started with down OST +Bugzilla : 9439,5706 +Description: Allow startup/shutdown of an MDS without depending on the + availability of the OSTs. +Details : Asynchronously call mds_lov_synchronize during MDS startup. + Add appropriate locking and lov-osc refcounts for safe + cleaning. Add osc abort_inflight calls in case the + synchronize never started. + +Severity : minor +Frequency : extremely rare. Never observed in practice. +Bugzilla : 9652 +Description: avoid generating lustre_handle cookie of 0. +Details : class_handle_hash() generates handle cookies by incrementing + global counter, and can hit 0 occasionaly (this is unlikely, but + not impossible, because initial value of cookie counter is + selected randonly). Value of 0 is used as a sentinel meaning + "unassigned handle" --- avoid it. Also coalesce two critical + sections in this function into one. + +Severity : enhancement +Frequency : liblustre-only +Bugzilla : 9528 +Description: allow liblustre clients to delegate truncate locking to OST +Details : To avoid overhead of locking, liblustre client instructs OST to + take extent lock in ost_punch() on client's behalf. New connection + flag is added to handle backward compatibility. + ------------------------------------------------------------------------------ 08-26-2005 Cluster File Systems, Inc. diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 4d12b85..6ca2ebc 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -589,6 +589,7 @@ lustre/conf/Makefile lustre/doc/Makefile lustre/include/Makefile lustre/include/linux/Makefile +lustre/include/linux/lustre_ver.h lustre/include/lustre/Makefile lustre/kernel_patches/targets/2.6-suse.target lustre/kernel_patches/targets/2.6-vanilla.target diff --git a/lustre/autoconf/lustre-version.ac b/lustre/autoconf/lustre-version.ac index 452fd17..b4d6c3c 100644 --- a/lustre/autoconf/lustre-version.ac +++ b/lustre/autoconf/lustre-version.ac @@ -1 +1,31 @@ -m4_define([LUSTRE_VERSION],[1.4.5.92]) +m4_define([LUSTRE_MAJOR],[1]) +m4_define([LUSTRE_MINOR],[4]) +m4_define([LUSTRE_PATCH],[5]) +m4_define([LUSTRE_FIX],[93]) + +dnl # 288 stands for 0.0.1.32 , next version with fixes is ok, but next after +dnl # next release candidate/beta would spill this warning already. +m4_define([LUSTRE_VER_ALLOWED_OFFSET],[288]) +m4_define([LUSTRE_VER_OFFSET_WARN],[288]) + +dnl # User editable part ends here. ----------------------------------------- + +m4_pattern_allow(AC_LUSTRE) +m4_define([LUSTRE_VERSION],m4_if(LUSTRE_FIX,[0],LUSTRE_MAJOR.LUSTRE_MINOR.LUSTR +E_PATCH,LUSTRE_MAJOR.LUSTRE_MINOR.LUSTRE_PATCH.LUSTRE_FIX)) + +[AC_LUSTRE_MAJOR]=LUSTRE_MAJOR +[AC_LUSTRE_MINOR]=LUSTRE_MINOR +[AC_LUSTRE_PATCH]=LUSTRE_PATCH +[AC_LUSTRE_FIX]=LUSTRE_FIX +[AC_LUSTRE_VERSION_STRING]=LUSTRE_VERSION +[AC_LUSTRE_VER_ALLOWED_OFFSET]=LUSTRE_VER_ALLOWED_OFFSET +[AC_LUSTRE_VER_OFFSET_WARN]=LUSTRE_VER_OFFSET_WARN + +AC_SUBST([AC_LUSTRE_MAJOR]) +AC_SUBST([AC_LUSTRE_MINOR]) +AC_SUBST([AC_LUSTRE_PATCH]) +AC_SUBST([AC_LUSTRE_FIX]) +AC_SUBST([AC_LUSTRE_VERSION_STRING]) +AC_SUBST([AC_LUSTRE_VER_ALLOWED_OFFSET]) +AC_SUBST([AC_LUSTRE_VER_OFFSET_WARN]) diff --git a/lustre/include/linux/Makefile.am b/lustre/include/linux/Makefile.am index 70f20f8..0bd6e28 100644 --- a/lustre/include/linux/Makefile.am +++ b/lustre/include/linux/Makefile.am @@ -15,4 +15,4 @@ EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_ha.h lustre_lib.h \ lustre_export.h lustre_log.h obd_echo.h \ lustre_compat25.h lustre_fsfilt.h lustre_import.h lustre_mds.h obd.h \ lvfs.h lvfs_linux.h lustre_cfg.h lustre_lite.h lustre_idl.h \ - lustre_quota.h lustre_ucache.h + lustre_quota.h lustre_ucache.h lustre_ver.h.in diff --git a/lustre/include/linux/lustre_cfg.h b/lustre/include/linux/lustre_cfg.h index 5b6afe1..124141c 100644 --- a/lustre/include/linux/lustre_cfg.h +++ b/lustre/include/linux/lustre_cfg.h @@ -48,7 +48,9 @@ enum lcfg_command_type { LCFG_ADD_CONN = 0x00cf00b, LCFG_DEL_CONN = 0x00cf00c, LCFG_LOV_ADD_OBD = 0x00cf00d, - LCFG_LOV_DEL_OBD = 0x00cf00e + LCFG_LOV_DEL_OBD = 0x00cf00e, + LCFG_PARAM = 0x00cf00f, + LCFG_MARKER = 0x00cf010 }; struct lustre_cfg_bufs { @@ -57,6 +59,9 @@ struct lustre_cfg_bufs { uint32_t lcfg_bufcount; }; +/* Mountconf transitional hack, should go away after 1.6 */ +#define LCFG_FLG_MOUNTCONF 0x400 + struct lustre_cfg { uint32_t lcfg_magic; uint32_t lcfg_version; diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 4b0783f..cb31eaa 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -73,36 +73,24 @@ #define CONNMGR_REQUEST_PORTAL 1 #define CONNMGR_REPLY_PORTAL 2 -//#define OSC_REQUEST_PORTAL 3 #define OSC_REPLY_PORTAL 4 -//#define OSC_BULK_PORTAL 5 -#define OST_REQUEST_PORTAL 6 +#define OST_IO_PORTAL 6 #define OST_CREATE_PORTAL 7 #define OST_BULK_PORTAL 8 -//#define MDC_REQUEST_PORTAL 9 #define MDC_REPLY_PORTAL 10 -//#define MDC_BULK_PORTAL 11 #define MDS_REQUEST_PORTAL 12 -//#define MDS_REPLY_PORTAL 13 #define MDS_BULK_PORTAL 14 #define LDLM_CB_REQUEST_PORTAL 15 #define LDLM_CB_REPLY_PORTAL 16 #define LDLM_CANCEL_REQUEST_PORTAL 17 #define LDLM_CANCEL_REPLY_PORTAL 18 -#define PTLBD_REQUEST_PORTAL 19 -#define PTLBD_REPLY_PORTAL 20 -#define PTLBD_BULK_PORTAL 21 #define MDS_SETATTR_PORTAL 22 #define MDS_READPAGE_PORTAL 23 -#define MGMT_REQUEST_PORTAL 24 -#define MGMT_REPLY_PORTAL 25 -#define MGMT_CLI_REQUEST_PORTAL 26 -#define MGMT_CLI_REPLY_PORTAL 27 -#define MGC_REQUEST_PORTAL 28 -#define MGC_REPLY_PORTAL 29 -#define MGS_REQUEST_PORTAL 30 -#define MGS_REPLY_PORTAL 31 - +#define MGC_REQUEST_PORTAL 24 +#define MGC_REPLY_PORTAL 25 +#define MGS_REQUEST_PORTAL 26 +#define MGS_REPLY_PORTAL 27 +#define OST_REQUEST_PORTAL 28 #define SVC_KILLED 1 #define SVC_EVENT 2 @@ -133,6 +121,11 @@ struct lustre_handle { }; #define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL +static inline int lustre_handle_is_used(struct lustre_handle *lh) +{ + return lh->cookie != 0ull; +} + /* we depend on this structure to be 8-byte aligned */ /* this type is only endian-adjusted in lustre_unpack_msg() */ struct lustre_msg { @@ -211,22 +204,51 @@ static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags) #define MSG_CONNECT_ASYNC 0x40 /* Connect flags */ - #define OBD_CONNECT_RDONLY 0x1ULL +#define OBD_CONNECT_INDEX 0x2ULL /* connect to specific LOV idx */ +#define OBD_CONNECT_GRANT 0x8ULL /* OSC acquires grant at connect */ #define OBD_CONNECT_SRVLOCK 0x10ULL /* server takes locks for client */ +#define OBD_CONNECT_VERSION 0x20ULL /* Server supports versions in ocd */ +#define OBD_CONNECT_REQPORTAL 0x40ULL /* Separate portal for non-IO reqs */ +#define OBD_CONNECT_ACL 0x80ULL /* client using access control lists */ +#define OBD_CONNECT_XATTR 0x100ULL /* client using extended attributes*/ +#define OBD_CONNECT_CROW 0x200ULL /* MDS is expecting create-on-write */ +/* + * set by servers supporting taking extent locks during obd_punch(). Currently + * is requested by liblustre clients only. See bug 9528. + */ +#define OBD_CONNECT_TRUNCLOCK 0x400ULL -#define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY) -#define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK) +#define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY|OBD_CONNECT_VERSION) +#define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ + OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ + OBD_CONNECT_TRUNCLOCK) #define ECHO_CONNECT_SUPPORTED (0) #define MGMT_CONNECT_SUPPORTED (0) +#define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\ + ((patch)<<8) + (fix)) +#define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255) +#define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255) +#define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255) +#define OBD_OCD_VERSION_FIX(version) ((int)(version)&255) + /* This structure is used for both request and reply. * * If we eventually have separate connect data for different types, which we * almost certainly will, then perhaps we stick a union in here. */ struct obd_connect_data { __u64 ocd_connect_flags; - __u64 padding[8]; + __u32 ocd_version; + __u32 ocd_grant; + __u32 ocd_index; + __u32 ocd_unused; + __u64 padding1; /* also fix lustre_swab_connect */ + __u64 padding2; /* also fix lustre_swab_connect */ + __u64 padding3; /* also fix lustre_swab_connect */ + __u64 padding4; /* also fix lustre_swab_connect */ + __u64 padding5; /* also fix lustre_swab_connect */ + __u64 padding6; /* also fix lustre_swab_connect */ }; extern void lustre_swab_connect(struct obd_connect_data *ocd); @@ -284,6 +306,12 @@ typedef uint32_t obd_count; #define OBD_FL_DEBUG_CHECK (0x00000040) /* echo client/server debug check */ #define OBD_FL_NO_USRQUOTA (0x00000100) /* the object's owner is over quota */ #define OBD_FL_NO_GRPQUOTA (0x00000200) /* the object's group is over quota */ +/* + * set this to delegate DLM locking during obd_punch() to the OSTs. Only OSTs + * that declared OBD_CONNECT_TRUNCLOCK in their connect flags support this + * functionality. + */ +#define OBD_FL_TRUNCLOCK (0x00000800) #define OBD_INLINESZ 80 @@ -310,8 +338,8 @@ struct obdo { obd_count o_misc; /* brw: o_dropped */ __u32 o_easize; /* epoch in ost writes */ __u32 o_mds; - __u32 o_padding_1; - __u32 o_padding_2; + __u32 o_padding_1; /* also fix lustre_swab_obdo */ + __u32 o_padding_2; /* also fix lustre_swab_obdo */ char o_inline[OBD_INLINESZ]; /* fid in ost writes */ }; @@ -604,7 +632,7 @@ struct obd_dqblk { __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; - __u32 padding; + __u32 padding; /* also fix lustre_swab_obd_quotactl */ }; #define Q_QUOTACHECK 0x800100 @@ -862,7 +890,7 @@ extern void lustre_swab_ldlm_intent (struct ldlm_intent *i); struct ldlm_resource_desc { ldlm_type_t lr_type; - __u32 lr_padding; + __u32 lr_padding; /* also fix lustre_swab_ldlm_resource_desc */ struct ldlm_res_id lr_name; }; @@ -879,7 +907,7 @@ extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l); struct ldlm_request { __u32 lock_flags; - __u32 lock_padding; + __u32 lock_padding; /* also fix lustre_swab_ldlm_request */ struct ldlm_lock_desc lock_desc; struct lustre_handle lock_handle1; struct lustre_handle lock_handle2; @@ -889,7 +917,7 @@ extern void lustre_swab_ldlm_request (struct ldlm_request *rq); struct ldlm_reply { __u32 lock_flags; - __u32 lock_padding; + __u32 lock_padding; /* also fix lustre_swab_ldlm_reply */ struct ldlm_lock_desc lock_desc; struct lustre_handle lock_handle; __u64 lock_policy_res1; @@ -898,46 +926,6 @@ struct ldlm_reply { extern void lustre_swab_ldlm_reply (struct ldlm_reply *r); -/* - * ptlbd, portal block device requests - */ -typedef enum { - PTLBD_QUERY = 200, - PTLBD_READ = 201, - PTLBD_WRITE = 202, - PTLBD_FLUSH = 203, - PTLBD_CONNECT = 204, - PTLBD_DISCONNECT = 205, - PTLBD_LAST_OPC -} ptlbd_cmd_t; -#define PTLBD_FIRST_OPC PTLBD_QUERY - -struct ptlbd_op { - __u16 op_cmd; - __u16 op_lun; - __u16 op_niob_cnt; - __u16 op__padding; - __u32 op_block_cnt; -}; - -extern void lustre_swab_ptlbd_op (struct ptlbd_op *op); - -struct ptlbd_niob { - __u64 n_xid; - __u64 n_block_nr; - __u32 n_offset; - __u32 n_length; -}; - -extern void lustre_swab_ptlbd_niob (struct ptlbd_niob *n); - -struct ptlbd_rsp { - __u16 r_status; - __u16 r_error_cnt; -}; - -extern void lustre_swab_ptlbd_rsp (struct ptlbd_rsp *r); - /* * Opcodes for mountconf (mgs and mgc) @@ -1002,7 +990,9 @@ struct llog_logid { #define CATLIST "CATALOGS" struct llog_catid { struct llog_logid lci_logid; - __u32 lci_padding[3]; + __u32 lci_padding1; + __u32 lci_padding2; + __u32 lci_padding3; } __attribute__((packed)); /* Log data record types - there is no specific reason that these need to @@ -1052,7 +1042,11 @@ struct llog_rec_tail { struct llog_logid_rec { struct llog_rec_hdr lid_hdr; struct llog_logid lid_id; - __u32 padding[5]; + __u32 padding1; + __u32 padding2; + __u32 padding3; + __u32 padding4; + __u32 padding5; struct llog_rec_tail lid_tail; } __attribute__((packed)); diff --git a/lustre/include/linux/lustre_import.h b/lustre/include/linux/lustre_import.h index 52ac2f9..aefa287 100644 --- a/lustre/include/linux/lustre_import.h +++ b/lustre/include/linux/lustre_import.h @@ -38,6 +38,7 @@ enum obd_import_event { IMP_EVENT_INACTIVE = 0x808002, IMP_EVENT_INVALIDATE = 0x808003, IMP_EVENT_ACTIVE = 0x808004, + IMP_EVENT_OCD = 0x808005, }; struct obd_import_conn { diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 2995129..c0f9099 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -486,68 +486,64 @@ static inline int ll_insecure_random_int(void) * configuration of interrupt and timeout sensitivity along with actions to * be performed in the event of either exception. * - * Common usage looks like this: + * The first form of usage looks like this: * * struct l_wait_info lwi = LWI_TIMEOUT_INTR(timeout, timeout_handler, * intr_handler, callback_data); * rc = l_wait_event(waitq, condition, &lwi); * - * (LWI_TIMEOUT and LWI_INTR macros are available for timeout- and - * interrupt-only variants, respectively.) + * l_wait_event() makes the current process wait on 'waitq' until 'condition' + * is TRUE or a "killable" signal (SIGTERM, SIKGILL, SIGINT) is pending. It + * returns 0 to signify 'condition' is TRUE, but if a signal wakes it before + * 'condition' becomes true, it optionally calls the specified 'intr_handler' + * if not NULL, and returns -EINTR. * - * If a timeout is specified, the timeout_handler will be invoked in the event - * that the timeout expires before the process is awakened. (Note that any - * waking of the process will restart the timeout, even if the condition is - * not satisfied and the process immediately returns to sleep. This might be - * considered a bug.) If the timeout_handler returns non-zero, l_wait_event - * will return -ETIMEDOUT and the caller will continue. If the handler returns - * zero instead, the process will go back to sleep until it is awakened by the - * waitq or some similar mechanism, or an interrupt occurs (if the caller has - * asked for interrupts to be detected). The timeout will only fire once, so - * callers should take care that a timeout_handler which returns zero will take - * future steps to awaken the process. N.B. that these steps must include - * making the provided condition become true. + * If a non-zero timeout is specified, signals are ignored until the timeout + * has expired. At this time, if 'timeout_handler' is not NULL it is called. + * If it returns FALSE l_wait_event() continues to wait as described above with + * signals enabled. Otherwise it returns -ETIMEDOUT. * - * If the interrupt flag (lwi_signals) is non-zero, then the process will be - * interruptible, and will be awakened by any "killable" signal (SIGTERM, - * SIGKILL or SIGINT). If a timeout is also specified, then the process will - * only become interruptible _after_ the timeout has expired, though it can be - * awakened by a signal that was delivered before the timeout and is still - * pending when the timeout expires. If a timeout is not specified, the process - * will be interruptible at all times during l_wait_event. + * LWI_INTR(intr_handler, callback_data) is shorthand for + * LWI_TIMEOUT_INTR(0, NULL, intr_handler, callback_data) + * + * The second form of usage looks like this: + * + * struct l_wait_info lwi = LWI_TIMEOUT(timeout, timeout_handler); + * rc = l_wait_event(waitq, condition, &lwi); + * + * This form is the same as the first except that it COMPLETELY IGNORES + * SIGNALS. The caller must therefore beware that if 'timeout' is zero, or if + * 'timeout_handler' is not NULL and returns FALSE, then the ONLY thing that + * can unblock the current process is 'condition' becoming TRUE. */ +#define LWI_ON_SIGNAL_NOOP ((void (*)(void *))(-1)) + struct l_wait_info { long lwi_timeout; int (*lwi_on_timeout)(void *); - long lwi_signals; void (*lwi_on_signal)(void *); void *lwi_cb_data; }; -#define LWI_TIMEOUT(time, cb, data) \ -((struct l_wait_info) { \ - lwi_timeout: time, \ - lwi_on_timeout: cb, \ - lwi_cb_data: data \ -}) - -#define LWI_INTR(cb, data) \ -((struct l_wait_info) { \ - lwi_signals: 1, \ - lwi_on_signal: cb, \ - lwi_cb_data: data \ +/* NB: LWI_TIMEOUT ignores signals completely */ +#define LWI_TIMEOUT(time, cb, data) \ +((struct l_wait_info) { \ + .lwi_timeout = time, \ + .lwi_on_timeout = cb, \ + .lwi_cb_data = data \ }) #define LWI_TIMEOUT_INTR(time, time_cb, sig_cb, data) \ ((struct l_wait_info) { \ - lwi_timeout: time, \ - lwi_on_timeout: time_cb, \ - lwi_signals: 1, \ - lwi_on_signal: sig_cb, \ - lwi_cb_data: data \ + .lwi_timeout = time, \ + .lwi_on_timeout = time_cb, \ + .lwi_on_signal = (sig_cb == NULL) ? LWI_ON_SIGNAL_NOOP : sig_cb, \ + .lwi_cb_data = data \ }) +#define LWI_INTR(cb, data) LWI_TIMEOUT_INTR(0, NULL, cb, data) + #define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | \ sigmask(SIGTERM) | sigmask(SIGQUIT) | \ sigmask(SIGALRM)) @@ -569,136 +565,139 @@ static inline sigset_t l_w_e_set_sigs(int sigs) #define __l_wait_event(wq, condition, info, ret, excl) \ do { \ - wait_queue_t __wait; \ - int __timed_out = 0; \ - unsigned long irqflags; \ - sigset_t blocked; \ - signed long timeout_remaining; \ + wait_queue_t __wait; \ + signed long __timeout = info->lwi_timeout; \ + unsigned long __irqflags; \ + sigset_t __blocked; \ + \ + ret = 0; \ + if (condition) \ + break; \ \ init_waitqueue_entry(&__wait, current); \ if (excl) \ - add_wait_queue_exclusive(&wq, &__wait); \ + add_wait_queue_exclusive(&wq, &__wait); \ else \ - add_wait_queue(&wq, &__wait); \ + add_wait_queue(&wq, &__wait); \ \ /* Block all signals (just the non-fatal ones if no timeout). */ \ - if (info->lwi_signals && !info->lwi_timeout) \ - blocked = l_w_e_set_sigs(LUSTRE_FATAL_SIGS); \ + if (info->lwi_on_signal != NULL && __timeout == 0) \ + __blocked = l_w_e_set_sigs(LUSTRE_FATAL_SIGS); \ else \ - blocked = l_w_e_set_sigs(0); \ - \ - timeout_remaining = info->lwi_timeout; \ + __blocked = l_w_e_set_sigs(0); \ \ for (;;) { \ - set_current_state(TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (info->lwi_timeout && !__timed_out) { \ - timeout_remaining = schedule_timeout(timeout_remaining); \ - if (timeout_remaining == 0) { \ - __timed_out = 1; \ - if (!info->lwi_on_timeout || \ - info->lwi_on_timeout(info->lwi_cb_data)) { \ - ret = -ETIMEDOUT; \ + set_current_state(TASK_INTERRUPTIBLE); \ + \ + if (condition) \ break; \ - } \ - /* We'll take signals after a timeout. */ \ - if (info->lwi_signals) \ - (void)l_w_e_set_sigs(LUSTRE_FATAL_SIGS); \ + \ + if (__timeout == 0) { \ + schedule(); \ + } else { \ + __timeout = schedule_timeout(__timeout); \ + if (__timeout == 0) { \ + if (info->lwi_on_timeout == NULL || \ + info->lwi_on_timeout(info->lwi_cb_data)) { \ + ret = -ETIMEDOUT; \ + break; \ + } \ + /* Take signals after the timeout expires. */ \ + if (info->lwi_on_signal != NULL) \ + (void)l_w_e_set_sigs(LUSTRE_FATAL_SIGS); \ + } \ } \ - } else { \ - schedule(); \ - } \ - if (condition) \ - break; \ - if (signal_pending(current)) { \ - if (!info->lwi_timeout || __timed_out) { \ - break; \ - } else { \ - /* We have to do this here because some signals */ \ - /* are not blockable - ie from strace(1). */ \ - /* In these cases we want to schedule_timeout() */ \ - /* again, because we don't want that to return */ \ - /* -EINTR when the RPC actually succeeded. */ \ - /* the RECALC_SIGPENDING below will deliver the */ \ - /* signal properly. */ \ - SIGNAL_MASK_LOCK(current, irqflags); \ - CLEAR_SIGPENDING; \ - SIGNAL_MASK_UNLOCK(current, irqflags); \ - } \ - } \ - } \ \ - SIGNAL_MASK_LOCK(current, irqflags); \ - current->blocked = blocked; \ - RECALC_SIGPENDING; \ - SIGNAL_MASK_UNLOCK(current, irqflags); \ + if (condition) \ + break; \ \ - if ((!info->lwi_timeout || __timed_out) && signal_pending(current)) { \ - if (info->lwi_on_signal) \ - info->lwi_on_signal(info->lwi_cb_data); \ - ret = -EINTR; \ + if (signal_pending(current)) { \ + if (info->lwi_on_signal != NULL && __timeout == 0) { \ + if (info->lwi_on_signal != LWI_ON_SIGNAL_NOOP) \ + info->lwi_on_signal(info->lwi_cb_data);\ + ret = -EINTR; \ + break; \ + } \ + /* We have to do this here because some signals */ \ + /* are not blockable - ie from strace(1). */ \ + /* In these cases we want to schedule_timeout() */ \ + /* again, because we don't want that to return */ \ + /* -EINTR when the RPC actually succeeded. */ \ + /* the RECALC_SIGPENDING below will deliver the */ \ + /* signal properly. */ \ + SIGNAL_MASK_LOCK(current, __irqflags); \ + CLEAR_SIGPENDING; \ + SIGNAL_MASK_UNLOCK(current, __irqflags); \ + } \ } \ \ + SIGNAL_MASK_LOCK(current, __irqflags); \ + current->blocked = __blocked; \ + RECALC_SIGPENDING; \ + SIGNAL_MASK_UNLOCK(current, __irqflags); \ + \ current->state = TASK_RUNNING; \ remove_wait_queue(&wq, &__wait); \ } while(0) #else /* !__KERNEL__ */ -#define __l_wait_event(wq, condition, info, ret, excl) \ -do { \ - long timeout = info->lwi_timeout, elapse, last = 0; \ - int __timed_out = 0; \ - \ - if (info->lwi_timeout == 0) \ - timeout = 1000000000; \ - else \ - last = time(NULL); \ - \ - for (;;) { \ - if (condition) \ - break; \ - if (liblustre_wait_event(timeout)) { \ - if (timeout == 0 || info->lwi_timeout == 0) \ - continue; \ - elapse = time(NULL) - last; \ - if (elapse) { \ - last += elapse; \ - timeout -= elapse; \ - if (timeout < 0) \ - timeout = 0; \ - } \ - continue; \ - } \ - if (info->lwi_timeout && !__timed_out) { \ - __timed_out = 1; \ - if (info->lwi_on_timeout == NULL || \ - info->lwi_on_timeout(info->lwi_cb_data)) { \ - ret = -ETIMEDOUT; \ - break; \ - } \ - } \ - } \ +#define __l_wait_event(wq, condition, info, ret, excl) \ +do { \ + long __timeout = info->lwi_timeout; \ + long __now; \ + long __then = 0; \ + int __timed_out = 0; \ + \ + ret = 0; \ + if (condition) \ + break; \ + \ + if (__timeout == 0) \ + __timeout = 1000000000; \ + else \ + __then = time(NULL); \ + \ + while (!(condition)) { \ + if (liblustre_wait_event(__timeout)) { \ + if (__timeout != 0 && info->lwi_timeout != 0) { \ + __now = time(NULL); \ + __timeout -= __now - __then; \ + if (__timeout < 0) \ + __timeout = 0; \ + __then = __now; \ + } \ + continue; \ + } \ + \ + if (info->lwi_timeout != 0 && !__timed_out) { \ + __timed_out = 1; \ + if (info->lwi_on_timeout == NULL || \ + info->lwi_on_timeout(info->lwi_cb_data)) { \ + ret = -ETIMEDOUT; \ + break; \ + } \ + } \ + } \ } while (0) #endif /* __KERNEL__ */ -#define l_wait_event(wq, condition, info) \ -({ \ - int __ret = 0; \ - struct l_wait_info *__info = (info); \ - if (!(condition)) \ - __l_wait_event(wq, condition, __info, __ret, 0); \ - __ret; \ +#define l_wait_event(wq, condition, info) \ +({ \ + int __ret; \ + struct l_wait_info *__info = (info); \ + \ + __l_wait_event(wq, condition, __info, __ret, 0); \ + __ret; \ }) -#define l_wait_event_exclusive(wq, condition, info) \ -({ \ - int __ret = 0; \ - struct l_wait_info *__info = (info); \ - if (!(condition)) \ - __l_wait_event(wq, condition, __info, __ret, 1); \ - __ret; \ +#define l_wait_event_exclusive(wq, condition, info) \ +({ \ + int __ret; \ + struct l_wait_info *__info = (info); \ + \ + __l_wait_event(wq, condition, __info, __ret, 1); \ + __ret; \ }) #define LMD_MAGIC 0xbdacbd03 diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h index 28ee37b..146bae0 100644 --- a/lustre/include/linux/lustre_lite.h +++ b/lustre/include/linux/lustre_lite.h @@ -126,3 +126,56 @@ static inline void lustre_build_lock_params(int cmd, unsigned long open_flags, params->lrp_ast_flags = (open_flags & O_NONBLOCK) ? LDLM_FL_BLOCK_NOWAIT : 0; } + +/* + * This is embedded into liblustre and llite super-blocks to keep track of + * connect flags (capabilities) supported by all imports given mount is + * connected to. + */ +struct lustre_client_ocd { + /* + * This is conjunction of connect_flags across all imports (LOVs) this + * mount is connected to. This field is updated by ll_ocd_update() + * under ->lco_lock. + */ + __u64 lco_flags; + spinlock_t lco_lock; +}; + +/* + * This function is used as an upcall-callback hooked by liblustre and llite + * clients into obd_notify() listeners chain to handle notifications about + * change of import connect_flags. See llu_fsswop_mount() and + * lustre_common_fill_super(). + * + * Again, it is dumped into this header for the lack of a better place. + */ +static inline int ll_ocd_update(struct obd_device *host, + struct obd_device *watched, + enum obd_notify_event ev, void *owner) +{ + struct lustre_client_ocd *lco; + struct client_obd *cli; + __u64 flags; + int result; + + ENTRY; + if (!strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) { + cli = &watched->u.cli; + lco = owner; + flags = cli->cl_import->imp_connect_data.ocd_connect_flags; + CDEBUG(D_SUPER, "Changing connect_flags: "LPX64" -> "LPX64"\n", + lco->lco_flags, flags); + spin_lock(&lco->lco_lock); + lco->lco_flags &= flags; + spin_unlock(&lco->lco_lock); + result = 0; + } else { + CERROR("unexpected notification of %s %s!\n", + watched->obd_type->typ_name, + watched->obd_name); + result = -EINVAL; + } + RETURN(result); +} + diff --git a/lustre/include/linux/lustre_log.h b/lustre/include/linux/lustre_log.h index 9ed9aee..42061d5 100644 --- a/lustre/include/linux/lustre_log.h +++ b/lustre/include/linux/lustre_log.h @@ -221,9 +221,9 @@ static inline void llog_gen_init(struct llog_ctxt *ctxt) { struct obd_device *obd = ctxt->loc_exp->exp_obd; - if (!strcmp(obd->obd_type->typ_name, "mds")) + if (!strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME)) ctxt->loc_gen.mnt_cnt = obd->u.mds.mds_mount_count; - else if (!strstr(obd->obd_type->typ_name, "filter")) + else if (!strstr(obd->obd_type->typ_name, LUSTRE_FILTER_NAME)) ctxt->loc_gen.mnt_cnt = obd->u.filter.fo_mount_count; else ctxt->loc_gen.mnt_cnt = 0; diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index 88b33d5..d1fc223 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -144,7 +144,7 @@ int it_disposition(struct lookup_intent *it, int flag); void it_set_disposition(struct lookup_intent *it, int flag); int it_open_error(int phase, struct lookup_intent *it); void mdc_set_lock_data(__u64 *lockh, void *data); -int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid, +int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid, ldlm_iterator_t it, void *data); int mdc_intent_lock(struct obd_export *exp, struct mdc_op_data *, diff --git a/lustre/include/linux/lustre_ver.h.in b/lustre/include/linux/lustre_ver.h.in new file mode 100644 index 0000000..4abf818 --- /dev/null +++ b/lustre/include/linux/lustre_ver.h.in @@ -0,0 +1,23 @@ +#ifndef _LUSTRE_VER_H_ +#define _LUSTRE_VER_H_ + +#include + +#define LUSTRE_MAJOR @AC_LUSTRE_MAJOR@ +#define LUSTRE_MINOR @AC_LUSTRE_MINOR@ +#define LUSTRE_PATCH @AC_LUSTRE_PATCH@ +#define LUSTRE_FIX @AC_LUSTRE_FIX@ +#define LUSTRE_VERSION_STRING "@AC_LUSTRE_VERSION_STRING@" + +// liblustre clients are only allowed to connect if their LUSTRE_FIX mismatches +// by this amount (set in lustre/autoconf/lustre-version.ac) +#define LUSTRE_VERSION_ALLOWED_OFFSET @AC_LUSTRE_VER_ALLOWED_OFFSET@ + +// if lustre version of client and servers it connects to differs by more than +// this amount, client would issue a warning +// (set in lustre/autoconf/lustre-version.ac) +#define LUSTRE_VERSION_OFFSET_WARN @AC_LUSTRE_VER_OFFSET_WARN@ + +#define LUSTRE_VERSION_CODE OBD_OCD_VERSION(LUSTRE_MAJOR,LUSTRE_MINOR,LUSTRE_PATCH,LUSTRE_FIX) + +#endif diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index a6dc3d7..813f17c 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -135,7 +135,7 @@ enum async_flags { or cancel the size of the io */ ASYNC_GROUP_SYNC = 0x8, /* ap_completion will not be called, instead the page is accounted for in the - obd_io_group given to + obd_io_group given to obd_queue_group_io */ }; @@ -163,7 +163,7 @@ struct obd_io_group { struct oig_callback_context { struct list_head occ_oig_item; /* called when the caller has received a signal while sleeping. - * callees of this method are encouraged to abort their state + * callees of this method are encouraged to abort their state * in the oig. This may be called multiple times. */ void (*occ_interrupted)(struct oig_callback_context *occ); unsigned int interrupted:1; @@ -190,6 +190,7 @@ struct filter_obd { spinlock_t fo_objidlock; /* protect fo_lastobjid increment */ spinlock_t fo_translock; /* protect fsd_last_rcvd increment */ struct file *fo_rcvd_filp; + struct file *fo_health_check_filp; struct lr_server_data *fo_fsd; unsigned long *fo_last_rcvd_slots; __u64 fo_mount_count; @@ -369,7 +370,7 @@ struct mds_obd { struct dentry *mds_logs_dir; struct dentry *mds_objects_dir; struct llog_handle *mds_cfg_llh; - struct llog_handle *mds_catalog; +// struct llog_handle *mds_catalog; struct obd_device *mds_osc_obd; /* XXX lov_obd */ struct obd_uuid mds_lov_uuid; char *mds_profile; @@ -380,6 +381,7 @@ struct mds_obd { int mds_lov_objids_valid; int mds_lov_nextid_set; struct file *mds_lov_objid_filp; + struct file *mds_health_check_filp; unsigned long *mds_client_bitmap; struct semaphore mds_orphan_recovery_sem; struct upcall_cache *mds_group_hash; @@ -397,37 +399,10 @@ struct echo_obd { atomic_t eo_prep; }; -/* - * this struct does double-duty acting as either a client or - * server instance .. maybe not wise. - */ -struct ptlbd_obd { - /* server's */ - struct ptlrpc_service *ptlbd_service; - struct file *filp; - /* client's */ - struct ptlrpc_client bd_client; - struct obd_import *bd_import; - struct obd_uuid bd_server_uuid; - struct obd_export *bd_exp; - int refcount; /* XXX sigh */ -}; - -struct recovd_obd { - spinlock_t recovd_lock; - struct list_head recovd_managed_items; /* items managed */ - struct list_head recovd_troubled_items; /* items in recovery */ - - wait_queue_head_t recovd_recovery_waitq; - wait_queue_head_t recovd_ctl_waitq; - wait_queue_head_t recovd_waitq; - struct task_struct *recovd_thread; - __u32 recovd_state; -}; - struct ost_obd { struct ptlrpc_service *ost_service; struct ptlrpc_service *ost_create_service; + struct ptlrpc_service *ost_io_service; struct semaphore ost_health_sem; }; @@ -439,23 +414,22 @@ struct echo_client_obd { __u64 ec_unique; }; -struct cache_obd { - struct obd_export *cobd_target_exp;/* local connection to target obd */ - struct obd_export *cobd_cache_exp; /* local connection to cache obd */ -}; - struct lov_tgt_desc { struct obd_uuid uuid; __u32 ltd_gen; struct obd_export *ltd_exp; - int active; /* is this target up for requests */ + unsigned int active:1, /* is this target up for requests */ + reap:1; /* should this target be deleted */ }; struct lov_obd { - spinlock_t lov_lock; + struct semaphore lov_lock; + atomic_t refcount; struct lov_desc desc; int bufsize; - int refcount; + int connects; + int death_row; /* Do we have tgts scheduled to be deleted? + (Make this a linked list?) */ unsigned int lo_catalog_loaded:1; struct lov_tgt_desc *tgts; }; @@ -470,6 +444,20 @@ struct niobuf_local { int rc; }; +/* device types */ +#define LUSTRE_MDS_NAME "mds" +#define LUSTRE_MDT_NAME "mdt" +#define LUSTRE_MDC_NAME "mdc" +#define LUSTRE_OSS_NAME "oss" +#define LUSTRE_OST_NAME "ost" +#define LUSTRE_OSC_NAME "osc" +#define LUSTRE_FILTER_NAME "filter" +#define LUSTRE_SANOSC_NAME "sanosc" +#define LUSTRE_SANOST_NAME "sanost" +#define LUSTRE_MGS_NAME "mgs" +#define LUSTRE_MGT_NAME "mgt" +#define LUSTRE_MGC_NAME "mgc" + /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */ #define N_LOCAL_TEMP_PAGE 0x10000000 @@ -488,7 +476,7 @@ struct obd_trans_info { int oti_numcookies; /* initial thread handling transaction */ - struct ptlrpc_thread *oti_thread; + struct ptlrpc_thread *oti_thread; }; static inline void oti_alloc_cookies(struct obd_trans_info *oti,int num_cookies) @@ -536,23 +524,44 @@ enum llog_ctxt_id { LLOG_MAX_CTXTS }; +/* + * Events signalled through obd_notify() upcall-chain. + */ +enum obd_notify_event { + /* Device activated */ + OBD_NOTIFY_ACTIVE, + /* Device deactivated */ + OBD_NOTIFY_INACTIVE, + /* Connect data for import were changed */ + OBD_NOTIFY_OCD +}; + +/* + * Data structure used to pass obd_notify()-event to non-obd listeners (llite + * and liblustre being main examples). + */ +struct obd_notify_upcall { + int (*onu_upcall)(struct obd_device *host, struct obd_device *watched, + enum obd_notify_event ev, void *owner); + /* Opaque datum supplied by upper layer listener */ + void *onu_owner; +}; + /* corresponds to one of the obd's */ struct obd_device { struct obd_type *obd_type; - /* common and UUID name of this device */ char *obd_name; struct obd_uuid obd_uuid; - struct obd_uuid obd_grp_uuid; /* for manual cleanup */ int obd_minor; unsigned int obd_attached:1, obd_set_up:1, obd_recovering:1, obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1, obd_no_recov:1, obd_stopping:1, obd_starting:1, obd_force:1, obd_fail:1, obd_async_recov:1; - atomic_t obd_refcount; - wait_queue_head_t obd_refcount_waitq; + atomic_t obd_refcount; + wait_queue_head_t obd_refcount_waitq; struct proc_dir_entry *obd_proc_entry; struct list_head obd_exports; int obd_num_exports; @@ -566,9 +575,10 @@ struct obd_device { struct obd_statfs obd_osfs; unsigned long obd_osfs_age; /* jiffies */ struct lvfs_run_ctxt obd_lvfs_ctxt; - struct llog_ctxt *obd_llog_ctxt[LLOG_MAX_CTXTS]; - struct obd_device *obd_observer; - struct obd_export *obd_self_export; + struct llog_ctxt *obd_llog_ctxt[LLOG_MAX_CTXTS]; + struct obd_device *obd_observer; + struct obd_notify_upcall obd_upcall; + struct obd_export *obd_self_export; /* list of exports in LRU order, for ping evictor, with obd_dev_lock */ struct list_head obd_exports_timed; time_t obd_eviction_timer; /* for ping evictor */ @@ -599,13 +609,10 @@ struct obd_device { struct ost_obd ost; struct echo_client_obd echo_client; struct echo_obd echo; - struct recovd_obd recovd; struct lov_obd lov; - struct cache_obd cobd; - struct ptlbd_obd ptlbd; struct mgs_obd mgs; } u; - /* Fields used by LProcFS */ + /* Fields used by LProcFS */ unsigned int obd_cntr_base; struct lprocfs_stats *obd_stats; struct proc_dir_entry *obd_svc_procroot; @@ -617,6 +624,19 @@ struct obd_device { #define OBD_LLOG_FL_SENDNOW 0x0001 + +/* Special case hack for MDS LOVs */ +#define OBD_CLEANUP_EARLY 0 +/* Precleanup stage 1, we must make sure all exports (other than the + self-export) get destroyed. */ +#define OBD_CLEANUP_EXPORTS 1 +/* Precleanup stage 2, do other type-specific cleanup requiring the + self-export. */ +#define OBD_CLEANUP_SELF_EXP 2 +/* FIXME we should eliminate the "precleanup" function and make them stages + of the "cleanup" function. */ +#define OBD_CLEANUP_OBD 3 + struct obd_ops { struct module *o_owner; int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len, @@ -642,6 +662,9 @@ struct obd_ops { * asked for. If @ocd == NULL, use default parameters. */ int (*o_connect)(struct lustre_handle *conn, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *ocd); + int (*o_reconnect)(struct obd_export *exp, struct obd_device *src, + struct obd_uuid *cluuid, + struct obd_connect_data *ocd); int (*o_disconnect)(struct obd_export *exp); int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs, @@ -672,26 +695,26 @@ struct obd_ops { struct lov_stripe_md *ea, obd_count oa_bufs, struct brw_page *pgarr, struct ptlrpc_request_set *, struct obd_trans_info *oti); - int (*o_prep_async_page)(struct obd_export *exp, + int (*o_prep_async_page)(struct obd_export *exp, struct lov_stripe_md *lsm, - struct lov_oinfo *loi, - struct page *page, obd_off offset, + struct lov_oinfo *loi, + struct page *page, obd_off offset, struct obd_async_page_ops *ops, void *data, void **res); - int (*o_queue_async_io)(struct obd_export *exp, - struct lov_stripe_md *lsm, - struct lov_oinfo *loi, void *cookie, - int cmd, obd_off off, int count, + int (*o_queue_async_io)(struct obd_export *exp, + struct lov_stripe_md *lsm, + struct lov_oinfo *loi, void *cookie, + int cmd, obd_off off, int count, obd_flag brw_flags, obd_flag async_flags); - int (*o_queue_group_io)(struct obd_export *exp, - struct lov_stripe_md *lsm, - struct lov_oinfo *loi, - struct obd_io_group *oig, - void *cookie, int cmd, obd_off off, int count, + int (*o_queue_group_io)(struct obd_export *exp, + struct lov_stripe_md *lsm, + struct lov_oinfo *loi, + struct obd_io_group *oig, + void *cookie, int cmd, obd_off off, int count, obd_flag brw_flags, obd_flag async_flags); - int (*o_trigger_group_io)(struct obd_export *exp, - struct lov_stripe_md *lsm, - struct lov_oinfo *loi, + int (*o_trigger_group_io)(struct obd_export *exp, + struct lov_stripe_md *lsm, + struct lov_oinfo *loi, struct obd_io_group *oig); int (*o_set_async_flags)(struct obd_export *exp, struct lov_stripe_md *lsm, @@ -738,7 +761,7 @@ struct obd_ops { __u32 mode, struct lustre_handle *); int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *, int flags, void *opaque); - int (*o_join_lru)(struct obd_export *, struct lov_stripe_md *, + int (*o_join_lru)(struct obd_export *, struct lov_stripe_md *, int join); int (*o_san_preprw)(int cmd, struct obd_export *exp, struct obdo *oa, int objcount, @@ -761,7 +784,7 @@ struct obd_ops { enum obd_import_event); int (*o_notify)(struct obd_device *obd, struct obd_device *watched, - int active); + enum obd_notify_event ev); int (*o_health_check)(struct obd_device *); @@ -769,7 +792,7 @@ struct obd_ops { int (*o_quotacheck)(struct obd_export *, struct obd_quotactl *); int (*o_quotactl)(struct obd_export *, struct obd_quotactl *); - /* + /* * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c. * Also, add a wrapper function in include/linux/obd_class.h. @@ -780,6 +803,7 @@ struct obd_ops { */ }; +int lvfs_check_io_health(struct obd_device *obd, struct file *file); static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno, int error) diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 6e00fd7..d4cc416e 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -49,17 +49,6 @@ extern struct obd_device obd_dev[MAX_OBD_DEVICES]; extern spinlock_t obd_dev_lock; -/* device types */ -#define LUSTRE_MDS_NAME "mds" -#define LUSTRE_MDT_NAME "mdt" -#define LUSTRE_MDC_NAME "mdc" -#define LUSTRE_OSS_NAME "oss" -#define LUSTRE_OST_NAME "ost" -#define LUSTRE_OSC_NAME "osc" -#define LUSTRE_MGS_NAME "mgs" -#define LUSTRE_MGT_NAME "mgt" -#define LUSTRE_MGC_NAME "mgc" - /* OBD Operations Declarations */ extern struct obd_device *class_conn2obd(struct lustre_handle *); extern struct obd_device *class_exp2obd(struct obd_export *); @@ -559,6 +548,26 @@ static inline int obd_connect(struct lustre_handle *conn, struct obd_device *obd RETURN(rc); } +static inline int obd_reconnect(struct obd_export *exp, + struct obd_device *obd, + struct obd_uuid *cluuid, + struct obd_connect_data *d) +{ + int rc; + __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition check */ + ENTRY; + + OBD_CHECK_DEV_ACTIVE(obd); + OBD_CHECK_OP(obd, reconnect, 0); + OBD_COUNTER_INCREMENT(obd, reconnect); + + rc = OBP(obd, reconnect)(exp, obd, cluuid, d); + /* check that only subset is granted */ + LASSERT(ergo(d != NULL, + (d->ocd_connect_flags & ocf) == d->ocd_connect_flags)); + RETURN(rc); +} + static inline int obd_disconnect(struct obd_export *exp) { int rc; @@ -1031,7 +1040,7 @@ static inline void obd_import_event(struct obd_device *obd, static inline int obd_notify(struct obd_device *obd, struct obd_device *watched, - int active) + enum obd_notify_event ev) { OBD_CHECK_DEV(obd); if (!obd->obd_set_up) { @@ -1045,7 +1054,32 @@ static inline int obd_notify(struct obd_device *obd, } OBD_COUNTER_INCREMENT(obd, notify); - return OBP(obd, notify)(obd, watched, active); + return OBP(obd, notify)(obd, watched, ev); +} + +static inline int obd_notify_observer(struct obd_device *observer, + struct obd_device *observed, + enum obd_notify_event ev) +{ + int rc1; + int rc2; + + struct obd_notify_upcall *onu; + + if (observer->obd_observer) + rc1 = obd_notify(observer->obd_observer, observed, ev); + else + rc1 = 0; + /* + * Also, call non-obd listener, if any + */ + onu = &observer->obd_upcall; + if (onu->onu_upcall != NULL) + rc2 = onu->onu_upcall(observer, observed, ev, onu->onu_owner); + else + rc2 = 0; + + return rc1 ?: rc2; } static inline int obd_quotacheck(struct obd_export *exp, diff --git a/lustre/include/linux/obd_ost.h b/lustre/include/linux/obd_ost.h index 28f9ed4..4a2a344 100644 --- a/lustre/include/linux/obd_ost.h +++ b/lustre/include/linux/obd_ost.h @@ -4,7 +4,7 @@ * This file is part of Lustre, http://www.lustre.org * * Data structures for object storage targets and client: OST & OSC's - * + * * See also lustre_idl.h for wire formats of requests. */ @@ -13,9 +13,6 @@ #include -#define LUSTRE_SANOSC_NAME "sanosc" -#define LUSTRE_SANOST_NAME "sanost" - struct osc_brw_async_args { struct obdo *aa_oa; int aa_requested_nob; diff --git a/lustre/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch b/lustre/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch index 31e7e38..6a6cf7c 100644 --- a/lustre/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch +++ b/lustre/kernel_patches/patches/ext3-mballoc2-2.6-suse.patch @@ -446,31 +446,31 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c +static inline int mb_test_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ return ext2_test_bit(bit, addr); ++ return ext3_test_bit(bit, addr); +} + +static inline void mb_set_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit(bit, addr); ++ ext3_set_bit(bit, addr); +} + +static inline void mb_set_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit_atomic(NULL, bit, addr); ++ ext3_set_bit_atomic(NULL, bit, addr); +} + +static inline void mb_clear_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit(bit, addr); ++ ext3_clear_bit(bit, addr); +} + +static inline void mb_clear_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit_atomic(NULL, bit, addr); ++ ext3_clear_bit_atomic(NULL, bit, addr); +} + +static inline void *mb_find_buddy(struct ext3_buddy *e3b, int order, int *max) @@ -1015,7 +1015,7 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c + i = e3b->bd_bd->bb_first_free; + + while (free && ac->ac_status != AC_STATUS_FOUND) { -+ i = ext2_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); ++ i = ext3_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); + if (i >= sb->s_blocksize * 8) { + J_ASSERT(free == 0); + break; @@ -1205,13 +1205,13 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c + + if (ac.ac_status == AC_STATUS_BREAK && + !(ac.ac_flags & EXT3_MB_HINT_FIRST)) { -+ /* -+ * We've been searching too long. Let's try to allocate -+ * the best chunk we've found so far -+ */ -+ ext3_warning(inode->i_sb, __FUNCTION__, -+ "too long searching: got %d want %d\n", -+ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); ++ /* We've been searching too long. Let's try to allocate ++ * the best chunk we've found so far. */ ++ if (ac.ac_g_ex.fe_len >= 128 && ++ ac.ac_b_ex.fe_len < ac.ac_g_ex.fe_len / 4) ++ ext3_warning(inode->i_sb, __FUNCTION__, ++ "too long searching: got %d want %d\n", ++ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); + ext3_mb_try_best_found(&ac, &e3b); + if (ac.ac_status != AC_STATUS_FOUND) { + /* @@ -1219,7 +1219,7 @@ Index: linux-2.6.5-7.201/fs/ext3/mballoc.c + * The only thing we can do is just take first + * found block(s) + */ -+ printk(KERN_ERR "EXT3-fs: and someone won our chunk\n"); ++ mb_debug(KERN_ERR "EXT3-fs: and someone won our chunk\n"); + ac.ac_b_ex.fe_group = 0; + ac.ac_b_ex.fe_start = 0; + ac.ac_b_ex.fe_len = 0; @@ -2413,7 +2413,7 @@ Index: linux-2.6.5-7.201/fs/ext3/super.c {Opt_extents, "extents"}, {Opt_extdebug, "extdebug"}, + {Opt_mballoc, "mballoc"}, -+ {Opt_mballoc, "mbfactor=%u"}, ++ {Opt_mbfactor, "mbfactor=%u"}, {Opt_err, NULL} }; diff --git a/lustre/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch b/lustre/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch index b3d9f73..3e1bafe 100644 --- a/lustre/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch +++ b/lustre/kernel_patches/patches/ext3-mballoc2-2.6.9-rhel4.patch @@ -463,31 +463,31 @@ Index: linux-2.6.9/fs/ext3/mballoc.c +static inline int mb_test_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ return ext2_test_bit(bit, addr); ++ return ext3_test_bit(bit, addr); +} + +static inline void mb_set_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit(bit, addr); ++ ext3_set_bit(bit, addr); +} + +static inline void mb_set_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_set_bit_atomic(NULL, bit, addr); ++ ext3_set_bit_atomic(NULL, bit, addr); +} + +static inline void mb_clear_bit(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit(bit, addr); ++ ext3_clear_bit(bit, addr); +} + +static inline void mb_clear_bit_atomic(int bit, void *addr) +{ + mb_correct_addr_and_bit(bit,addr); -+ ext2_clear_bit_atomic(NULL, bit, addr); ++ ext3_clear_bit_atomic(NULL, bit, addr); +} + +static inline void *mb_find_buddy(struct ext3_buddy *e3b, int order, int *max) @@ -1032,7 +1032,7 @@ Index: linux-2.6.9/fs/ext3/mballoc.c + i = e3b->bd_bd->bb_first_free; + + while (free && ac->ac_status != AC_STATUS_FOUND) { -+ i = ext2_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); ++ i = ext3_find_next_zero_bit(bitmap, sb->s_blocksize * 8, i); + if (i >= sb->s_blocksize * 8) { + J_ASSERT(free == 0); + break; @@ -1222,13 +1222,13 @@ Index: linux-2.6.9/fs/ext3/mballoc.c + + if (ac.ac_status == AC_STATUS_BREAK && + !(ac.ac_flags & EXT3_MB_HINT_FIRST)) { -+ /* -+ * We've been searching too long. Let's try to allocate -+ * the best chunk we've found so far -+ */ -+ ext3_warning(inode->i_sb, __FUNCTION__, -+ "too long searching: got %d want %d\n", -+ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); ++ /* We've been searching too long. Let's try to allocate ++ * the best chunk we've found so far. */ ++ if (ac.ac_g_ex.fe_len >= 128 && ++ ac.ac_b_ex.fe_len < ac.ac_g_ex.fe_len / 4) ++ ext3_warning(inode->i_sb, __FUNCTION__, ++ "too long searching: got %d want %d\n", ++ ac.ac_b_ex.fe_len, ac.ac_g_ex.fe_len); + ext3_mb_try_best_found(&ac, &e3b); + if (ac.ac_status != AC_STATUS_FOUND) { + /* @@ -1236,7 +1236,7 @@ Index: linux-2.6.9/fs/ext3/mballoc.c + * The only thing we can do is just take first + * found block(s) + */ -+ printk(KERN_ERR "EXT3-fs: and someone won our chunk\n"); ++ mb_debug(KERN_ERR "EXT3-fs: and someone won our chunk\n"); + ac.ac_b_ex.fe_group = 0; + ac.ac_b_ex.fe_start = 0; + ac.ac_b_ex.fe_len = 0; @@ -2428,7 +2428,7 @@ Index: linux-2.6.9/fs/ext3/super.c {Opt_extents, "extents"}, {Opt_extdebug, "extdebug"}, + {Opt_mballoc, "mballoc"}, -+ {Opt_mballoc, "mbfactor=%u"}, ++ {Opt_mbfactor, "mbfactor=%u"}, {Opt_barrier, "barrier=%u"}, {Opt_err, NULL}, {Opt_resize, "resize"}, diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 79f5a22..542dd76 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -33,10 +33,9 @@ # include #endif #include -#include /* for LUSTRE_OSC_NAME */ -#include /* for LUSTRE_MDC_NAME */ -#include /* for LUSTRE_MGC_NAME */ +#include #include +#include #include /* @priority: if non-zero, move the selected to the list head @@ -195,13 +194,13 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) struct obd_uuid server_uuid; int rq_portal, rp_portal, connect_op; char *name = obddev->obd_type->typ_name; - int is_mgc = 0, rc; + int rc; ENTRY; /* In a more perfect world, we would hang a ptlrpc_client off of * obd_type and just use the values from there. */ if (!strcmp(name, LUSTRE_OSC_NAME)) { - rq_portal = OST_REQUEST_PORTAL; + rq_portal = OST_IO_PORTAL; rp_portal = OSC_REPLY_PORTAL; connect_op = OST_CONNECT; } else if (!strcmp(name, LUSTRE_MDC_NAME)) { @@ -212,7 +211,6 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) rq_portal = MGC_REQUEST_PORTAL; rp_portal = MGC_REPLY_PORTAL; connect_op = MGMT_CONNECT; - is_mgc++; } else { CERROR("unknown client OBD type \"%s\", can't setup\n", name); @@ -245,39 +243,34 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) min_t(unsigned int, LUSTRE_CFG_BUFLEN(lcfg, 2), sizeof(server_uuid))); - /* Only need by osc/mdc */ - if (!is_mgc) { - cli->cl_dirty = 0; - cli->cl_avail_grant = 0; - /* FIXME: should limit this for the sum of all cl_dirty_max */ - cli->cl_dirty_max = OSC_MAX_DIRTY_DEFAULT * 1024 * 1024; - if (cli->cl_dirty_max >> PAGE_SHIFT > num_physpages / 8) - cli->cl_dirty_max = num_physpages << (PAGE_SHIFT - 3); - INIT_LIST_HEAD(&cli->cl_cache_waiters); - INIT_LIST_HEAD(&cli->cl_loi_ready_list); - INIT_LIST_HEAD(&cli->cl_loi_write_list); - INIT_LIST_HEAD(&cli->cl_loi_read_list); - spin_lock_init(&cli->cl_loi_list_lock); - cli->cl_r_in_flight = 0; - cli->cl_w_in_flight = 0; - spin_lock_init(&cli->cl_read_rpc_hist.oh_lock); - spin_lock_init(&cli->cl_write_rpc_hist.oh_lock); - spin_lock_init(&cli->cl_read_page_hist.oh_lock); - spin_lock_init(&cli->cl_write_page_hist.oh_lock); - spin_lock_init(&cli->cl_read_offset_hist.oh_lock); - spin_lock_init(&cli->cl_write_offset_hist.oh_lock); - if (num_physpages >> (20 - PAGE_SHIFT) <= 128) { - /* <= 128 MB */ - cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES / 4; - cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT / 4; - } else if (num_physpages >> (20 - PAGE_SHIFT) <= 512) { - /* <= 512 MB */ - cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES / 2; - cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT / 2; - } else { - cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES; - cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT; - } + cli->cl_dirty = 0; + cli->cl_avail_grant = 0; + /* FIXME: should limit this for the sum of all cl_dirty_max */ + cli->cl_dirty_max = OSC_MAX_DIRTY_DEFAULT * 1024 * 1024; + if (cli->cl_dirty_max >> PAGE_SHIFT > num_physpages / 8) + cli->cl_dirty_max = num_physpages << (PAGE_SHIFT - 3); + INIT_LIST_HEAD(&cli->cl_cache_waiters); + INIT_LIST_HEAD(&cli->cl_loi_ready_list); + INIT_LIST_HEAD(&cli->cl_loi_write_list); + INIT_LIST_HEAD(&cli->cl_loi_read_list); + spin_lock_init(&cli->cl_loi_list_lock); + cli->cl_r_in_flight = 0; + cli->cl_w_in_flight = 0; + spin_lock_init(&cli->cl_read_rpc_hist.oh_lock); + spin_lock_init(&cli->cl_write_rpc_hist.oh_lock); + spin_lock_init(&cli->cl_read_page_hist.oh_lock); + spin_lock_init(&cli->cl_write_page_hist.oh_lock); + spin_lock_init(&cli->cl_read_offset_hist.oh_lock); + spin_lock_init(&cli->cl_write_offset_hist.oh_lock); + if (num_physpages >> (20 - PAGE_SHIFT) <= 128) { /* <= 128 MB */ + cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES / 4; + cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT / 4; + } else if (num_physpages >> (20 - PAGE_SHIFT) <= 256) { /* <= 256 MB */ + cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES / 2; + cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT / 2; + } else { + cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES; + cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT; } rc = ldlm_get_ref(); @@ -309,13 +302,10 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) } cli->cl_import = imp; - /* cli->cl_max_mds_{easize,cookiesize} updated by mdc_init_ea_size() */ - if (!is_mgc) { - cli->cl_max_mds_easize = sizeof(struct lov_mds_md); - cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); - cli->cl_sandev = to_kdev_t(0); - } + cli->cl_max_mds_easize = sizeof(struct lov_mds_md); + cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); + cli->cl_sandev = to_kdev_t(0); if (LUSTRE_CFG_BUFLEN(lcfg, 3) > 0) { if (!strcmp(lustre_cfg_string(lcfg, 3), "inactive")) { @@ -326,10 +316,8 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) } } - if (!is_mgc) { - spin_lock_init(&cli->cl_qchk_lock); - cli->cl_qchk_stat = CL_NO_QUOTACHECK; - } + spin_lock_init(&cli->cl_qchk_lock); + cli->cl_qchk_stat = CL_NO_QUOTACHECK; RETURN(rc); @@ -494,7 +482,8 @@ int target_handle_reconnect(struct lustre_handle *conn, struct obd_export *exp, CWARN("%s reconnecting\n", cluuid->uuid); conn->cookie = exp->exp_handle.h_cookie; /* target_handle_connect() treats EALREADY and - * -EALREADY differently */ + * -EALREADY differently. EALREADY means we are + * doing a valid reconnect from the same client. */ RETURN(EALREADY); } else { CERROR("%s reconnecting from %s, " @@ -504,7 +493,8 @@ int target_handle_reconnect(struct lustre_handle *conn, struct obd_export *exp, hdl->cookie, conn->cookie); memset(conn, 0, sizeof *conn); /* target_handle_connect() treats EALREADY and - * -EALREADY differently */ + * -EALREADY differently. -EALREADY is an error + * (same UUID, different handle). */ RETURN(-EALREADY); } } @@ -597,6 +587,22 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) if (rc) GOTO(out, rc); + if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) { + if (!data || (data->ocd_version < LUSTRE_VERSION_CODE - + LUSTRE_VERSION_ALLOWED_OFFSET)) { + DEBUG_REQ(D_INFO, req, "Refusing old (%d.%d.%d.%d) " + "libclient connection attempt\n", + OBD_OCD_VERSION_MAJOR(data->ocd_version), + OBD_OCD_VERSION_MINOR(data->ocd_version), + OBD_OCD_VERSION_PATCH(data->ocd_version), + OBD_OCD_VERSION_FIX(data->ocd_version)); + data = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*data)); + data->ocd_connect_flags = OBD_CONNECT_VERSION; + data->ocd_version = LUSTRE_VERSION_CODE; + GOTO(out, rc = -EPROTO); + } + } + /* lctl gets a backstage, all-access pass. */ if (obd_uuid_equals(&cluuid, &target->obd_uuid)) goto dont_check_exports; @@ -622,6 +628,12 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) GOTO(out, rc = -EALREADY); } + /* We indicate the reconnection in a flag, not an error code. */ + if (rc == EALREADY) { + lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_RECONNECT); + rc = 0; + } + /* Tell the client if we're in recovery. */ /* If this is the first client, start the recovery timer */ if (target->obd_recovering) { @@ -645,8 +657,15 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) dont_check_exports: rc = obd_connect(&conn, target, &cluuid, data); } + } else { + rc = obd_reconnect(export, target, &cluuid, data); } + /* we want to handle EALREADY but *not* -EALREADY from + * target_handle_reconnect() */ + if (rc && rc != EALREADY) + GOTO(out, rc); + /* Return only the parts of obd_connect_data that we understand, so the * client knows that we don't understand the rest. */ if (data) @@ -656,11 +675,6 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) /* If all else goes well, this is our RPC return code. */ req->rq_status = 0; - /* we want to handle EALREADY but *not* -EALREADY from - * target_handle_reconnect() */ - if (rc && rc != EALREADY) - GOTO(out, rc); - req->rq_repmsg->handle = conn; /* If the client and the server are the same node, we will already @@ -701,11 +715,9 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) export->exp_connection = ptlrpc_get_connection(req->rq_peer, req->rq_self, &remote_uuid); - if (rc == EALREADY) { - /* We indicate the reconnection in a flag, not an error code. */ - lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_RECONNECT); + + if (lustre_msg_get_op_flags(req->rq_repmsg) & MSG_CONNECT_RECONNECT) GOTO(out, rc = 0); - } if (target->obd_recovering) target->obd_connected_clients++; diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 911dfc9..53ae069 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -513,7 +513,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode) { struct ldlm_lock *lock = __ldlm_handle2lock(lockh, 0); - LASSERT(lock != NULL); + LASSERTF(lock != NULL, "Non-existing lock: "LPX64"\n", lockh->cookie); ldlm_lock_decref_internal(lock, mode); LDLM_LOCK_PUT(lock); } @@ -801,6 +801,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, ldlm_error_t rc = ELDLM_OK; ENTRY; + do_gettimeofday(&lock->l_enqueued_time); /* policies are not executed on the client or during replay */ if ((*flags & (LDLM_FL_HAS_INTENT|LDLM_FL_REPLAY)) == LDLM_FL_HAS_INTENT && !local && ns->ns_policy) { @@ -836,7 +837,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns, /* Some flags from the enqueue want to make it into the AST, via the * lock's l_flags. */ - lock->l_flags |= (*flags & (LDLM_AST_DISCARD_DATA|LDLM_INHERIT_FLAGS)); + lock->l_flags |= *flags & LDLM_AST_DISCARD_DATA; /* This distinction between local lock trees is very important; a client * namespace only has information about locks taken by that client, and diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index c00fa37..1a32008 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -263,6 +263,7 @@ static int ldlm_add_waiting_lock(struct ldlm_lock *lock) unsigned long timeout_rounded; l_check_ns_lock(lock->l_resource->lr_namespace); + LASSERT(!(lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK)); spin_lock_bh(&waiting_locks_spinlock); if (lock->l_destroyed) { @@ -348,6 +349,7 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock) static int ldlm_add_waiting_lock(struct ldlm_lock *lock) { + LASSERT(!(lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK)); RETURN(1); } @@ -477,12 +479,11 @@ int ldlm_server_blocking_ast(struct ldlm_lock *lock, LDLM_DEBUG(lock, "server preparing blocking AST"); req->rq_replen = lustre_msg_size(0, NULL); - if (instant_cancel) { + if (instant_cancel) ldlm_lock_cancel(lock); -// ldlm_reprocess_all(lock->l_resource); - } else if (lock->l_granted_mode == lock->l_req_mode) { + else if (lock->l_granted_mode == lock->l_req_mode) ldlm_add_waiting_lock(lock); - } + l_unlock(&lock->l_resource->lr_namespace->ns_lock); req->rq_send_state = LUSTRE_IMP_FULL; @@ -565,8 +566,18 @@ int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data) l_lock(&lock->l_resource->lr_namespace->ns_lock); if (lock->l_flags & LDLM_FL_AST_SENT) { body->lock_flags |= LDLM_FL_AST_SENT; - body->lock_flags &= ~LDLM_FL_CANCEL_ON_BLOCK; - ldlm_add_waiting_lock(lock); /* start the lock-timeout clock */ + + /* We might get here prior to ldlm_handle_enqueue setting + LDLM_FL_CANCEL_ON_BLOCK flag. Then we will put this lock into + waiting list, but this is safe and similar code in + ldlm_handle_enqueue will call ldlm_lock_cancel() still, that + would not only cancel the loc, but will also remove it from + waiting list */ + if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) + ldlm_lock_cancel(lock); + else + ldlm_add_waiting_lock(lock); /* start the lock-timeout + clock */ } l_unlock(&lock->l_resource->lr_namespace->ns_lock); @@ -766,6 +777,12 @@ existing_lock: /* We never send a blocking AST until the lock is granted, but * we can tell it right now */ l_lock(&lock->l_resource->lr_namespace->ns_lock); + + /* Now take into account flags to be inherited from original lock + request both in reply to client and in our own lock flags. */ + dlm_rep->lock_flags |= dlm_req->lock_flags & LDLM_INHERIT_FLAGS; + lock->l_flags |= dlm_req->lock_flags & LDLM_INHERIT_FLAGS; + /* Don't move a pending lock onto the export if it has already * been evicted. Cancel it now instead. (bug 5683) */ if (req->rq_export->exp_failed || @@ -774,10 +791,33 @@ existing_lock: rc = -ENOTCONN; } else if (lock->l_flags & LDLM_FL_AST_SENT) { dlm_rep->lock_flags |= LDLM_FL_AST_SENT; - dlm_rep->lock_flags &= ~LDLM_FL_CANCEL_ON_BLOCK; - if (lock->l_granted_mode == lock->l_req_mode) + if (dlm_rep->lock_flags & LDLM_FL_CANCEL_ON_BLOCK) + ldlm_lock_cancel(lock); + else if (lock->l_granted_mode == lock->l_req_mode) ldlm_add_waiting_lock(lock); } + if ((dlm_req->lock_desc.l_resource.lr_type == LDLM_PLAIN) && + req->rq_export->exp_libclient) { + if (!(lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) || + !(dlm_rep->lock_flags & LDLM_FL_CANCEL_ON_BLOCK)) { + CERROR("Granting sync lock to libclient. " + "req fl %d, rep fl %d, lock fl %d\n", + dlm_req->lock_flags, dlm_rep->lock_flags, + lock->l_flags); + LDLM_ERROR(lock, "sync lock"); + if (dlm_req->lock_flags & LDLM_FL_HAS_INTENT) { + struct ldlm_intent *it; + it = lustre_msg_buf(req->rq_reqmsg, 1, + sizeof(*it)); + if (it != NULL) { + CERROR("This is intent %s (" + LPU64 ")\n", + ldlm_it2str(it->opc), it->opc); + } + } + } + } + l_unlock(&lock->l_resource->lr_namespace->ns_lock); EXIT; @@ -818,8 +858,10 @@ existing_lock: if (!err && dlm_req->lock_desc.l_resource.lr_type != LDLM_FLOCK) ldlm_reprocess_all(lock->l_resource); + LDLM_LOCK_PUT(lock); } + LDLM_DEBUG_NOLOCK("server-side enqueue handler END (lock %p, rc %d)", lock, rc); diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index 04d0894..97f3e57 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -418,7 +418,7 @@ _SYSIO_OFF_T llu_iop_pos(struct inode *ino, _SYSIO_OFF_T off) /* this isn't where truncate starts. roughly: * llu_iop_{open,setattr}->llu_setattr_raw->llu_vmtruncate->llu_truncate * we grab the lock back in setattr_raw to avoid races. */ -static void llu_truncate(struct inode *inode) +static void llu_truncate(struct inode *inode, obd_flag flags) { struct llu_inode_info *lli = llu_i2info(inode); struct intnl_stat *st = llu_i2stat(inode); @@ -439,8 +439,11 @@ static void llu_truncate(struct inode *inode) oa.o_id = lsm->lsm_object_id; oa.o_valid = OBD_MD_FLID; - obdo_from_inode(&oa, inode, OBD_MD_FLTYPE|OBD_MD_FLMODE|OBD_MD_FLATIME| - OBD_MD_FLMTIME | OBD_MD_FLCTIME); + obdo_from_inode(&oa, inode, + OBD_MD_FLTYPE|OBD_MD_FLMODE|OBD_MD_FLATIME| + OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLFLAGS); + + oa.o_flags |= flags; /* OBD_MD_FLFLAGS is already set at this point */ obd_adjust_kms(llu_i2obdexp(inode), lsm, st->st_size, 1); @@ -462,11 +465,17 @@ static void llu_truncate(struct inode *inode) return; } /* llu_truncate */ -int llu_vmtruncate(struct inode * inode, loff_t offset) +int llu_vmtruncate(struct inode * inode, loff_t offset, obd_flag flags) { llu_i2stat(inode)->st_size = offset; - llu_truncate(inode); + /* + * llu_truncate() is only called from this + * point. llu_vmtruncate/llu_truncate split exists to mimic the + * structure of Linux VFS truncate code path. + */ + + llu_truncate(inode, flags); return 0; } diff --git a/lustre/liblustre/llite_lib.c b/lustre/liblustre/llite_lib.c index 54d9a37..82d8662 100644 --- a/lustre/liblustre/llite_lib.c +++ b/lustre/liblustre/llite_lib.c @@ -56,6 +56,7 @@ #include "lutil.h" #include "llite_lib.h" +#include static int lllib_init(void) { @@ -87,6 +88,7 @@ int liblustre_process_log(struct config_llog_instance *cfg, struct llog_ctxt *ctxt; lnet_nid_t nid = 0; int err, rc = 0; + struct obd_connect_data *ocd = NULL; ENTRY; generate_random_uuid(uuid); @@ -129,12 +131,18 @@ int liblustre_process_log(struct config_llog_instance *cfg, if (obd == NULL) GOTO(out_cleanup, rc = -EINVAL); + OBD_ALLOC(ocd, sizeof(*ocd)); + if (ocd == NULL) + GOTO(out_cleanup, rc = -ENOMEM); + + ocd->ocd_version = LUSTRE_VERSION_CODE; + /* Disable initial recovery on this import */ rc = obd_set_info(obd->obd_self_export, strlen("initial_recov"), "initial_recov", sizeof(allow_recov), &allow_recov); - rc = obd_connect(&mdc_conn, obd, &mdc_uuid, NULL /*connect_flags*/); + rc = obd_connect(&mdc_conn, obd, &mdc_uuid, ocd); if (rc) { CERROR("cannot connect to %s: rc = %d\n", mdsname, rc); GOTO(out_cleanup, rc); @@ -155,6 +163,9 @@ int liblustre_process_log(struct config_llog_instance *cfg, CERROR("obd_disconnect failed: rc = %d\n", err); out_cleanup: + if (ocd) + OBD_FREE(ocd, sizeof(*ocd)); + lustre_cfg_bufs_reset(&bufs, name); lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs); err = class_process_config(lcfg); diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index a6371924..54d0dc5 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -25,17 +25,17 @@ struct ll_file_data { struct llu_sb_info { - struct obd_uuid ll_sb_uuid; - struct obd_export *ll_mdc_exp; - struct obd_export *ll_osc_exp; - obd_id ll_rootino; - int ll_flags; - __u64 ll_connect_flags; - struct list_head ll_conn_chain; - - struct obd_uuid ll_mds_uuid; - struct obd_uuid ll_mds_peer_uuid; - char *ll_instance; + struct obd_uuid ll_sb_uuid; + struct obd_export *ll_mdc_exp; + struct obd_export *ll_osc_exp; + obd_id ll_rootino; + int ll_flags; + struct lustre_client_ocd ll_lco; + struct list_head ll_conn_chain; + + struct obd_uuid ll_mds_uuid; + struct obd_uuid ll_mds_peer_uuid; + char *ll_instance; }; #define LL_SBI_NOLCK 0x1 @@ -51,7 +51,7 @@ struct llu_inode_info { char *lli_symlink_name; struct semaphore lli_open_sem; __u64 lli_maxbytes; - unsigned long lli_flags; + unsigned long lli_flags; /* for libsysio */ struct file_identifier lli_sysio_fid; @@ -202,7 +202,7 @@ int llu_iop_open(struct pnode *pnode, int flags, mode_t mode); int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode); int llu_iop_close(struct inode *inode); _SYSIO_OFF_T llu_iop_pos(struct inode *ino, _SYSIO_OFF_T off); -int llu_vmtruncate(struct inode * inode, loff_t offset); +int llu_vmtruncate(struct inode * inode, loff_t offset, obd_flag obd_flags); void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid); int llu_objects_destroy(struct ptlrpc_request *request, struct inode *dir); diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index 5bd5642..3804c93 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -262,7 +262,7 @@ int llu_extent_lock(struct ll_file_data *fd, struct inode *inode, int rc; ENTRY; - LASSERT(lockh->cookie == 0); + LASSERT(!lustre_handle_is_used(lockh)); CLASSERT(ELDLM_OK == 0); /* XXX phil: can we do this? won't it screw the file size up? */ @@ -459,7 +459,7 @@ static int llu_queue_pio(int cmd, struct llu_io_group *group, * The root of the problem is that * * kms = lov_merge_size(lsm, 1); - * if (end > kms) + * if (end >= kms) * glimpse_size(inode); * else * st->st_size = kms; @@ -587,7 +587,7 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, RETURN(-ERANGE); lustre_build_lock_params(session->lis_cmd, lli->lli_open_flags, - lli->lli_sbi->ll_connect_flags, + lli->lli_sbi->ll_lco.lco_flags, pos, len, &p); iogroup = get_io_group(inode, max_io_pages(len, iovlen), &p); @@ -609,7 +609,8 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, * detection. Rely in OST to handle short reads in that case. */ kms = lov_merge_size(lsm, 1); - if (p.lrp_policy.l_extent.end > kms) { + /* extent.end is last byte of the range */ + if (p.lrp_policy.l_extent.end >= kms) { /* A glimpse is necessary to determine whether * we return a short read or some zeroes at * the end of the buffer @@ -620,14 +621,14 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, * comment. */ if ((err = llu_glimpse_size(inode))) { - llu_extent_unlock(fd, inode, lsm, - p.lrp_lock_mode, &lockh); - GOTO(err_put, err); + GOTO(err_unlock, err); } - } else + } else { st->st_size = kms; - } else if (lli->lli_open_flags & O_APPEND) + } + } else if (lli->lli_open_flags & O_APPEND) { pos = st->st_size; + } for (iovidx = 0; iovidx < iovlen; iovidx++) { char *buf = (char *) iovec[iovidx].iov_base; @@ -638,9 +639,7 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, if (len < count) count = len; if (IS_BAD_PTR(buf) || IS_BAD_PTR(buf + count)) { - llu_extent_unlock(fd, inode, - lsm, p.lrp_lock_mode, &lockh); - GOTO(err_put, err = -EFAULT); + GOTO(err_unlock, err = -EFAULT); } if (is_read) { @@ -648,9 +647,7 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, break; } else { if (pos >= lli->lli_maxbytes) { - llu_extent_unlock(fd, inode, lsm, - p.lrp_lock_mode, &lockh); - GOTO(err_put, err = -EFBIG); + GOTO(err_unlock, err = -EFBIG); } if (pos + count >= lli->lli_maxbytes) count = lli->lli_maxbytes - pos; @@ -658,9 +655,7 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, ret = llu_queue_pio(session->lis_cmd, iogroup, buf, count, pos); if (ret < 0) { - llu_extent_unlock(fd, inode, - lsm, p.lrp_lock_mode, &lockh); - GOTO(err_put, err = ret); + GOTO(err_unlock, err = ret); } else { pos += ret; if (!is_read) { @@ -677,19 +672,25 @@ ssize_t llu_file_prwv(const struct iovec *iovec, int iovlen, } LASSERT(len == 0 || is_read); /* libsysio should guarantee this */ - /* - * BUG: lock is released too early. Fix is in bug 9296. - */ - err = llu_extent_unlock(fd, inode, lsm, p.lrp_lock_mode, &lockh); - if (err) - CERROR("extent unlock error %d\n", err); - err = obd_trigger_group_io(exp, lsm, NULL, iogroup->lig_oig); if (err) - GOTO(err_put, err); + GOTO(err_unlock, err); + + err = oig_wait(iogroup->lig_oig); + if (err) { + CERROR("sync error %d, data corruption possible\n", err); + GOTO(err_unlock, err); + } + + ret = llu_extent_unlock(fd, inode, lsm, p.lrp_lock_mode, &lockh); + if (ret) + CERROR("extent unlock error %d\n", ret); session->lis_groups[session->lis_ngroups++] = iogroup; RETURN(0); + +err_unlock: + llu_extent_unlock(fd, inode, lsm, p.lrp_lock_mode, &lockh); err_put: put_io_group(iogroup); RETURN((ssize_t)err); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 422b658..06a8619 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -51,6 +51,7 @@ #undef LIST_HEAD #include "llite_lib.h" +#include #ifndef MAY_EXEC #define MAY_EXEC 1 @@ -340,7 +341,7 @@ int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm) static struct inode* llu_new_inode(struct filesys *fs, struct ll_fid *fid) { - struct inode *inode; + struct inode *inode; struct llu_inode_info *lli; struct intnl_stat st = { st_dev: 0, @@ -371,11 +372,11 @@ static struct inode* llu_new_inode(struct filesys *fs, memcpy(&lli->lli_fid, fid, sizeof(*fid)); /* file identifier is needed by functions like _sysio_i_find() */ - inode = _sysio_i_new(fs, &lli->lli_sysio_fid, + inode = _sysio_i_new(fs, &lli->lli_sysio_fid, &st, 0, &llu_inode_ops, lli); - if (!inode) - OBD_FREE(lli, sizeof(*lli)); + if (!inode) + OBD_FREE(lli, sizeof(*lli)); return inode; } @@ -579,12 +580,14 @@ static int inode_setattr(struct inode * inode, struct iattr * attr) struct intnl_stat *st = llu_i2stat(inode); int error = 0; - if (ia_valid & ATTR_SIZE) { - error = llu_vmtruncate(inode, attr->ia_size); - if (error) - goto out; - } + /* + * inode_setattr() is only ever invoked with ATTR_SIZE (by + * llu_setattr_raw()) when file has no bodies. Check this. + */ + LASSERT(ergo(ia_valid & ATTR_SIZE, llu_i2info(inode)->lli_smd == NULL)); + if (ia_valid & ATTR_SIZE) + st->st_size = attr->ia_size; if (ia_valid & ATTR_UID) st->st_uid = attr->ia_uid; if (ia_valid & ATTR_GID) @@ -601,7 +604,6 @@ static int inode_setattr(struct inode * inode, struct iattr * attr) st->st_mode &= ~S_ISGID; } /* mark_inode_dirty(inode); */ -out: return error; } @@ -711,10 +713,10 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr) (rc = ll_permission(inode, MAY_WRITE)) != 0) RETURN(rc); } else { - /* from inode_change_ok() */ - if (current->fsuid != st->st_uid && - !capable(CAP_FOWNER)) - RETURN(-EPERM); + /* from inode_change_ok() */ + if (current->fsuid != st->st_uid && + !capable(CAP_FOWNER)) + RETURN(-EPERM); } } @@ -726,27 +728,46 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr) if (ia_valid & ATTR_SIZE) { ldlm_policy_data_t policy = { .l_extent = {attr->ia_size, OBD_OBJECT_EOF} }; - struct lustre_handle lockh = { 0 }; - int err, ast_flags = 0; + struct lustre_handle lockh = { 0, }; + struct lustre_handle match_lockh = { 0, }; + + int err; + int flags = LDLM_FL_TEST_LOCK; /* for assertion check below */ + int lock_mode; + obd_flag obd_flags; + + /* check that there are no matching locks */ + LASSERT(obd_match(sbi->ll_osc_exp, lsm, LDLM_EXTENT, &policy, + LCK_PW, &flags, inode, &match_lockh) <= 0); + /* XXX when we fix the AST intents to pass the discard-range * XXX extent, make ast_flags always LDLM_AST_DISCARD_DATA * XXX here. */ - if (attr->ia_size == 0) - ast_flags = LDLM_AST_DISCARD_DATA; + flags = (attr->ia_size == 0) ? LDLM_AST_DISCARD_DATA : 0; + + if (sbi->ll_lco.lco_flags & OBD_CONNECT_TRUNCLOCK) { + lock_mode = LCK_NL; + obd_flags = OBD_FL_TRUNCLOCK; + CDEBUG(D_INODE, "delegating locking to the OST"); + } else { + lock_mode = LCK_PW; + obd_flags = 0; + } - rc = llu_extent_lock(NULL, inode, lsm, LCK_PW, &policy, - &lockh, ast_flags); + /* with lock_mode == LK_NL no lock is taken. */ + rc = llu_extent_lock(NULL, inode, lsm, lock_mode, &policy, + &lockh, flags); if (rc != ELDLM_OK) { if (rc > 0) RETURN(-ENOLCK); RETURN(rc); } - rc = llu_vmtruncate(inode, attr->ia_size); + rc = llu_vmtruncate(inode, attr->ia_size, obd_flags); /* unlock now as we don't mind others file lockers racing with * the mds updates below? */ - err = llu_extent_unlock(NULL, inode, lsm, LCK_PW, &lockh); + err = llu_extent_unlock(NULL, inode, lsm, lock_mode, &lockh); if (err) { CERROR("llu_extent_unlock failed: %d\n", err); if (!rc) @@ -1665,7 +1686,7 @@ llu_fsswop_mount(const char *source, struct config_llog_instance cfg; char ll_instance[sizeof(sbi) * 2 + 1]; struct lustre_profile *lprof; - char *zconf_mdsnid, *zconf_mdsname, *zconf_profile; + char *zconf_mdsnid, *zconf_mdsname, *zconf_profile; char *osc = NULL, *mdc = NULL; int async = 1, err = -EINVAL; struct obd_connect_data ocd = {0,}; @@ -1740,8 +1761,11 @@ llu_fsswop_mount(const char *source, obd_set_info(obd->obd_self_export, strlen("async"), "async", sizeof(async), &async); + ocd.ocd_connect_flags = OBD_CONNECT_VERSION; + ocd.ocd_version = LUSTRE_VERSION_CODE; + /* setup mdc */ - err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, NULL /* ocd */); + err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, &ocd); if (err) { CERROR("cannot connect to %s: rc = %d\n", mdc, err); GOTO(out_free, err); @@ -1765,14 +1789,19 @@ llu_fsswop_mount(const char *source, obd_set_info(obd->obd_self_export, strlen("async"), "async", sizeof(async), &async); - ocd.ocd_connect_flags |= OBD_CONNECT_SRVLOCK; + obd->obd_upcall.onu_owner = &sbi->ll_lco; + obd->obd_upcall.onu_upcall = ll_ocd_update; + + ocd.ocd_connect_flags = OBD_CONNECT_SRVLOCK|OBD_CONNECT_REQPORTAL| + OBD_CONNECT_VERSION|OBD_CONNECT_TRUNCLOCK; + ocd.ocd_version = LUSTRE_VERSION_CODE; err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, &ocd); if (err) { CERROR("cannot connect to %s: rc = %d\n", osc, err); GOTO(out_mdc, err); } sbi->ll_osc_exp = class_conn2export(&osc_conn); - sbi->ll_connect_flags = ocd.ocd_connect_flags; + sbi->ll_lco.lco_flags = ocd.ocd_connect_flags; mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); @@ -1806,19 +1835,19 @@ llu_fsswop_mount(const char *source, GOTO(out_request, err = -EBADF); } - /* - * Generate base path-node for root. - */ - rootpb = _sysio_pb_new(&noname, NULL, root); - if (!rootpb) { - err = -ENOMEM; - goto out_inode; - } + /* + * Generate base path-node for root. + */ + rootpb = _sysio_pb_new(&noname, NULL, root); + if (!rootpb) { + err = -ENOMEM; + goto out_inode; + } - err = _sysio_do_mount(fs, rootpb, flags, tocover, mntp); - if (err) { + err = _sysio_do_mount(fs, rootpb, flags, tocover, mntp); + if (err) { _sysio_pb_gone(rootpb); - goto out_inode; + goto out_inode; } ptlrpc_req_finished(request); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 13c47a3..fbd8dcf 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -147,7 +147,7 @@ struct ll_sb_info { int ll_flags; struct list_head ll_conn_chain; /* per-conn chain of SBs */ - __u64 ll_connect_flags; + struct lustre_client_ocd ll_lco; struct hlist_head ll_orphan_dentry_list; /*please don't ask -p*/ struct ll_close_queue *ll_lcq; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 569dbe8..423a82a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -84,6 +85,7 @@ struct ll_sb_info *ll_init_sbi(void) RETURN(NULL); spin_lock_init(&sbi->ll_lock); + spin_lock_init(&sbi->ll_lco.lco_lock); INIT_LIST_HEAD(&sbi->ll_pglist); sbi->ll_pglist_gen = 0; if (num_physpages >> (20 - PAGE_SHIFT) < 512) @@ -161,6 +163,8 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) sbi->ll_fop = &ll_file_operations; } + data->ocd_connect_flags |= OBD_CONNECT_VERSION; + data->ocd_version = LUSTRE_VERSION_CODE; err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid, data); if (err == -EBUSY) { CERROR("An MDT (mdc %s) is performing recovery, of which this" @@ -200,6 +204,16 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) GOTO(out_mdc, err); } + data->ocd_connect_flags = + OBD_CONNECT_GRANT|OBD_CONNECT_VERSION|OBD_CONNECT_REQPORTAL; + + CDEBUG(D_RPCTRACE, "ocd_connect_flags: "LPX64" ocd_version: %d " + "ocd_grant: %d\n", data->ocd_connect_flags, + data->ocd_version, data->ocd_grant); + + obd->obd_upcall.onu_owner = &sbi->ll_lco; + obd->obd_upcall.onu_upcall = ll_ocd_update; + err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid, data); if (err == -EBUSY) { CERROR("An OST (osc %s) is performing recovery, of which this" @@ -211,7 +225,9 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) GOTO(out_mdc, err); } sbi->ll_osc_exp = class_conn2export(&osc_conn); - sbi->ll_connect_flags = data->ocd_connect_flags; + spin_lock(&sbi->ll_lco.lco_lock); + sbi->ll_lco.lco_flags = data->ocd_connect_flags; + spin_unlock(&sbi->ll_lco.lco_lock); mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); @@ -433,9 +449,9 @@ void ll_options(char *options, char **ost, char **mdc, int *flags) #endif { CDEBUG(D_SUPER, "this_char %s\n", this_char); - if (!*ost && (*ost = ll_read_opt("osc", this_char))) + if (!*ost && (*ost = ll_read_opt(LUSTRE_OSC_NAME, this_char))) continue; - if (!*mdc && (*mdc = ll_read_opt("mdc", this_char))) + if (!*mdc && (*mdc = ll_read_opt(LUSTRE_MDC_NAME, this_char))) continue; tmp = ll_set_opt("nolock", this_char, LL_SBI_NOLCK); if (tmp) { diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 27c8f71..f2e2c12 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -103,7 +103,7 @@ static int ll_brw(int cmd, struct inode *inode, struct obdo *oa, /* this isn't where truncate starts. roughly: * sys_truncate->ll_setattr_raw->vmtruncate->ll_truncate. setattr_raw grabs - * DLM lock on [0, EOF], i_sem, ->lli_size_sem, and WRITE_I_ALLOC_SEM to + * DLM lock on [size, EOF], i_sem, ->lli_size_sem, and WRITE_I_ALLOC_SEM to * avoid races. * * must be called under ->lli_size_sem */ @@ -477,7 +477,7 @@ int llap_shrink_cache(struct ll_sb_info *sbi, int shrink_fraction) ll_teardown_mmaps(page->mapping, (__u64)page->index<index<mapping); ll_truncate_complete_page(page); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index a2f7979..48266ce 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -55,7 +55,44 @@ #include "lov_internal.h" -/* obd methods */ + +/* FIXME add lov_get/putrefs around every access to lov->tgts for on-line non- + quiescent ost removal */ +/* Keep a refcount of lov->tgt usage to prevent racing with deletion */ +static void lov_getref(struct obd_device *obd) +{ + struct lov_obd *lov = &obd->u.lov; + + /* nobody gets through here until lov_putref is done */ + down(&lov->lov_lock); + atomic_inc(&lov->refcount); + up(&lov->lov_lock); + return; +} + +static void __lov_del_obd(struct obd_device *obd, struct lov_tgt_desc *tgt); + +static void lov_putref(struct obd_device *obd) +{ + struct lov_obd *lov = &obd->u.lov; + down(&lov->lov_lock); + /* ok to dec to 0 more than once -- ltd_exp's will be null */ + if (atomic_dec_and_test(&lov->refcount) && lov->death_row) { + struct lov_tgt_desc *tgt; + int i; + CDEBUG(D_CONFIG, "destroying %d lov targets\n", lov->death_row); + for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; + i++, tgt++) { + if (!tgt->reap) + continue; + /* Disconnect and delete from list */ + __lov_del_obd(obd, tgt); + lov->death_row--; + } + } + up(&lov->lov_lock); +} + #define MAX_STRING_SIZE 128 static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt, int activate, struct obd_connect_data *data) @@ -124,6 +161,7 @@ static int lov_connect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt, } tgt->active = 1; + tgt->reap = 0; lov->desc.ld_active_tgt_count++; #ifdef __KERNEL__ @@ -173,8 +211,8 @@ static int lov_connect(struct lustre_handle *conn, struct obd_device *obd, /* We don't want to actually do the underlying connections more than * once, so keep track. */ - lov->refcount++; - if (lov->refcount > 1) { + lov->connects++; + if (lov->connects > 1) { class_export_put(exp); RETURN(0); } @@ -265,16 +303,15 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) RETURN(0); } -static int -lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen); +static int lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, + int index, int gen); static int lov_disconnect(struct obd_export *exp) { struct obd_device *obd = class_exp2obd(exp); - struct obd_device *osc_obd; struct lov_obd *lov = &obd->u.lov; struct lov_tgt_desc *tgt; - int rc, i; + int i, rc; ENTRY; rc = class_disconnect(exp); @@ -283,24 +320,20 @@ static int lov_disconnect(struct obd_export *exp) RETURN(rc); /* Only disconnect the underlying layers on the final disconnect. */ - lov->refcount--; - if (lov->refcount != 0) + lov->connects--; + if (lov->connects != 0) RETURN(rc); + /* Let's hold another reference so lov_del_obd doesn't spin through + putref every time */ + lov_getref(obd); for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) { if (tgt->ltd_exp) { - osc_obd = class_exp2obd(tgt->ltd_exp); - /* Disconnect and delete from list */ + /* Disconnection is the last we know about an obd */ lov_del_obd(obd, &tgt->uuid, i, tgt->ltd_gen); - /* Cleanup the osc now - can't do it from - lov_cleanup because we just lost our only reference - to it. */ - /* Use lov's force/fail flags. */ - osc_obd->obd_force = obd->obd_force; - osc_obd->obd_fail = obd->obd_fail; - class_manual_cleanup(osc_obd); } } + lov_putref(obd); RETURN(rc); } @@ -321,7 +354,6 @@ static int lov_set_osc_active(struct lov_obd *lov, struct obd_uuid *uuid, CDEBUG(D_INFO, "Searching in lov %p for uuid %s (activate=%d)\n", lov, uuid->uuid, activate); - spin_lock(&lov->lov_lock); for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) { if (tgt->ltd_exp == NULL) continue; @@ -352,17 +384,16 @@ static int lov_set_osc_active(struct lov_obd *lov, struct obd_uuid *uuid, EXIT; out: - spin_unlock(&lov->lov_lock); return rc; } static int lov_notify(struct obd_device *obd, struct obd_device *watched, - int active) + enum obd_notify_event ev) { int rc; struct obd_uuid *uuid; - if (strcmp(watched->obd_type->typ_name, "osc")) { + if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) { CERROR("unexpected notification of %s %s!\n", watched->obd_type->typ_name, watched->obd_name); @@ -370,19 +401,24 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched, } uuid = &watched->u.cli.cl_import->imp_target_uuid; - /* Set OSC as active before notifying the observer, so the - * observer can use the OSC normally. - */ - rc = lov_set_osc_active(&obd->u.lov, uuid, active); - if (rc) { - CERROR("%sactivation of %s failed: %d\n", - active ? "" : "de", uuid->uuid, rc); - RETURN(rc); + if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE) { + /* Set OSC as active before notifying the observer, so the + * observer can use the OSC normally. + */ + lov_getref(obd); + rc = lov_set_osc_active(&obd->u.lov, uuid, + ev == OBD_NOTIFY_ACTIVE); + lov_putref(obd); + if (rc) { + CERROR("%sactivation of %s failed: %d\n", + (ev == OBD_NOTIFY_ACTIVE) ? "" : "de", + uuid->uuid, rc); + RETURN(rc); + } } - if (obd->obd_observer) - /* Pass the notification up the chain. */ - rc = obd_notify(obd->obd_observer, watched, active); + /* Pass the notification up the chain. */ + rc = obd_notify_observer(obd, watched, ev); RETURN(rc); } @@ -453,7 +489,7 @@ lov_add_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) CDEBUG(D_CONFIG, "idx=%d ltd_gen=%d ld_tgt_count=%d\n", index, tgt->ltd_gen, lov->desc.ld_tgt_count); - if (lov->refcount == 0) + if (lov->connects == 0) /* lov_connect hasn't been called yet. So we'll do the lov_connect_obd on this obd when that fn first runs. */ RETURN(0); @@ -494,6 +530,7 @@ lov_add_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) return rc; } +/* Schedule a target for deletion */ static int lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) { @@ -503,9 +540,6 @@ lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) int rc = 0; ENTRY; - CDEBUG(D_CONFIG, "uuid: %s idx: %d gen: %d\n", - uuidp->uuid, index, gen); - if (index >= count) { CERROR("LOV target index %d >= number of LOV OBDs %d.\n", index, count); @@ -525,6 +559,25 @@ lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) RETURN(-EINVAL); } + CDEBUG(D_CONFIG, "uuid: %s idx: %d gen: %d exp: %p active: %d\n", + tgt->uuid.uuid, index, tgt->ltd_gen, tgt->ltd_exp, tgt->active); + + lov_getref(obd); + tgt->reap = 1; + lov->death_row++; + /* we really delete it from lov_putref */ + lov_putref(obd); + + RETURN(rc); +} + +static void __lov_del_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) +{ + struct obd_device *osc_obd; + + LASSERT(tgt->reap); + osc_obd = class_exp2obd(tgt->ltd_exp); + if (tgt->ltd_exp) lov_disconnect_obd(obd, tgt); @@ -535,10 +588,15 @@ lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen) /* lt_gen = 0 will mean it will not match the gen of any valid loi */ memset(tgt, 0, sizeof(*tgt)); - CDEBUG(D_CONFIG, "uuid: %s idx: %d gen: %d exp: %p active: %d\n", - tgt->uuid.uuid, index, tgt->ltd_gen, tgt->ltd_exp, tgt->active); - - RETURN(rc); + /* Manual cleanup - no cleanup logs to clean up the osc's. We must + do it ourselves. And we can't do it from lov_cleanup, + because we just lost our only reference to it. */ + if (osc_obd) { + /* Use lov's force/fail flags. */ + osc_obd->obd_force = obd->obd_force; + osc_obd->obd_fail = obd->obd_fail; + class_manual_cleanup(osc_obd); + } } static int lov_setup(struct obd_device *obd, obd_count len, void *buf) @@ -616,7 +674,8 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf) desc->ld_active_tgt_count = 0; lov->desc = *desc; - spin_lock_init(&lov->lov_lock); + sema_init(&lov->lov_lock, 1); + atomic_set(&lov->refcount, 0); lprocfs_init_vars(lov, &lvars); lprocfs_obd_setup(obd, lvars.obd_vars); @@ -641,13 +700,23 @@ static int lov_precleanup(struct obd_device *obd, int stage) int rc = 0; ENTRY; - if (stage < 2) - RETURN(0); - - rc = obd_llog_finish(obd, 0); - if (rc != 0) - CERROR("failed to cleanup llogging subsystems\n"); - + switch (stage) { + case OBD_CLEANUP_EARLY: { + struct lov_obd *lov = &obd->u.lov; + int i; + for (i = 0; i < lov->desc.ld_tgt_count; i++) { + if (!lov->tgts[i].active) + continue; + obd_precleanup(class_exp2obd(lov->tgts[i].ltd_exp), + OBD_CLEANUP_EARLY); + } + break; + } + case OBD_CLEANUP_SELF_EXP: + rc = obd_llog_finish(obd, 0); + if (rc != 0) + CERROR("failed to cleanup llogging subsystems\n"); + } RETURN(rc); } @@ -661,8 +730,12 @@ static int lov_cleanup(struct obd_device *obd) struct lov_tgt_desc *tgt; for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) { - if (!obd_uuid_empty(&tgt->uuid)) + /* We should never get here - these should have + been removed in the disconnect. */ + if (!obd_uuid_empty(&tgt->uuid)) { + CERROR("lov tgt %d not cleaned!\n", i); lov_del_obd(obd, &tgt->uuid, i, 0); + } } OBD_FREE(lov->tgts, lov->bufsize); } @@ -1834,7 +1907,7 @@ static int lov_statfs(struct obd_device *obd, struct obd_statfs *osfs, } else { #ifdef MIN_DF /* Sandia requested that df (and so, statfs) only - returned minimal available space on + returned minimal available space on a single OST, so people would be able to write this much data guaranteed. */ if (osfs->os_bavail > lov_sfs.os_bavail) { @@ -1982,12 +2055,14 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen, { struct obd_device *obddev = class_exp2obd(exp); struct lov_obd *lov = &obddev->u.lov; - int i; + int i, rc; ENTRY; if (!vallen || !val) RETURN(-EFAULT); + lov_getref(obddev); + if (keylen > strlen("lock_to_stripe") && strcmp(key, "lock_to_stripe") == 0) { struct { @@ -1999,7 +2074,7 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen, __u32 *stripe = val; if (*vallen < sizeof(*stripe)) - RETURN(-EFAULT); + GOTO(out, rc = -EFAULT); *vallen = sizeof(*stripe); /* XXX This is another one of those bits that will need to @@ -2014,12 +2089,12 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen, if (lov->tgts[loi->loi_ost_idx].ltd_exp == data->lock->l_conn_export) { *stripe = i; - RETURN(0); + GOTO(out, rc = 0); } } LDLM_ERROR(data->lock, "lock on inode without such object\n"); dump_lsm(D_ERROR, data->lsm); - RETURN(-ENXIO); + GOTO(out, rc = -ENXIO); } else if (keylen >= strlen("size_to_stripe") && strcmp(key, "size_to_stripe") == 0) { struct { @@ -2029,31 +2104,34 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen, } *data = val; if (*vallen < sizeof(*data)) - RETURN(-EFAULT); + GOTO(out, rc = -EFAULT); data->size = lov_size_to_stripe(data->lsm, data->size, data->stripe_number); - RETURN(0); + GOTO(out, rc = 0); } else if (keylen >= strlen("last_id") && strcmp(key, "last_id") == 0) { obd_id *ids = val; - int rc, size = sizeof(obd_id); + int size = sizeof(obd_id); for (i = 0; i < lov->desc.ld_tgt_count; i++) { if (!lov->tgts[i].active) continue; rc = obd_get_info(lov->tgts[i].ltd_exp, keylen, key, &size, &(ids[i])); if (rc != 0) - RETURN(rc); + GOTO(out, rc); } - RETURN(0); + GOTO(out, rc = 0); } else if (keylen >= strlen("lovdesc") && strcmp(key, "lovdesc") == 0) { struct lov_desc *desc_ret = val; *desc_ret = lov->desc; - RETURN(0); + GOTO(out, rc = 0); } - RETURN(-EINVAL); + rc = -EINVAL; +out: + lov_putref(obddev); + RETURN(rc); } static int lov_set_info(struct obd_export *exp, obd_count keylen, @@ -2070,6 +2148,8 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen, vallen = sizeof(obd_id); } + lov_getref(obddev); + if (KEY_IS("next_id") || KEY_IS("checksum")) { for (i = 0; i < lov->desc.ld_tgt_count; i++) { /* OST was disconnected */ @@ -2082,7 +2162,7 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen, if (!rc) rc = err; } - RETURN(rc); + GOTO(out, rc); } if (KEY_IS("evict_by_nid")) { @@ -2096,14 +2176,14 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen, if (!rc) rc = err; } - RETURN(rc); + GOTO(out, rc); } if (KEY_IS("mds_conn") || KEY_IS("unlinked")) { if (vallen != 0) - RETURN(-EINVAL); + GOTO(out, rc = -EINVAL); } else { - RETURN(-EINVAL); + GOTO(out, rc = -EINVAL); } for (i = 0; i < lov->desc.ld_tgt_count; i++) { @@ -2122,6 +2202,8 @@ static int lov_set_info(struct obd_export *exp, obd_count keylen, if (!rc) rc = err; } +out: + lov_putref(obddev); RETURN(rc); } diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index a471eea..a7ca4f0 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -139,10 +139,10 @@ int lov_get_stripecnt(struct lov_obd *lov, int stripe_count) { if (!stripe_count) stripe_count = lov->desc.ld_default_stripe_count; - if (!stripe_count) - stripe_count = 1; if (stripe_count > lov->desc.ld_active_tgt_count) stripe_count = lov->desc.ld_active_tgt_count; + if (!stripe_count) + stripe_count = 1; /* for now, we limit the stripe count directly, when bug 4424 is * fixed this needs to be somewhat dynamic based on whether ext3 * can handle larger EA sizes. */ diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index afe58d9..0a0e8b3 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -469,6 +469,26 @@ EXPORT_SYMBOL(lvfs_set_rdonly); EXPORT_SYMBOL(lvfs_check_rdonly); EXPORT_SYMBOL(lvfs_clear_rdonly); +int lvfs_check_io_health(struct obd_device *obd, struct file *file) +{ + char *write_page = NULL; + loff_t offset = 0; + int rc = 0; + ENTRY; + + OBD_ALLOC(write_page, PAGE_SIZE); + if (!write_page) + RETURN(-ENOMEM); + + rc = fsfilt_write_record(obd, file, write_page, PAGE_SIZE, &offset, 1); + + OBD_FREE(write_page, PAGE_SIZE); + + CDEBUG(D_INFO, "write 1 page synchronously for checking io rc %d\n",rc); + RETURN(rc); +} +EXPORT_SYMBOL(lvfs_check_io_health); + static int __init lvfs_linux_init(void) { RETURN(0); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index f52d543..c78ac4a 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -98,7 +98,7 @@ int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid) 0); } -int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size, +int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size, struct ptlrpc_request *req) { struct mds_body *body; @@ -398,7 +398,7 @@ static void mdc_replay_open(struct ptlrpc_request *req) struct mdc_open_data *mod = req->rq_cb_data; struct obd_client_handle *och; struct ptlrpc_request *close_req; - struct lustre_handle old; + struct lustre_handle old; struct mds_body *body; ENTRY; @@ -414,14 +414,14 @@ static void mdc_replay_open(struct ptlrpc_request *req) och = mod->mod_och; if (och != NULL) { - struct lustre_handle *file_fh; + struct lustre_handle *file_fh; LASSERT(och->och_magic == OBD_CLIENT_HANDLE_MAGIC); file_fh = &och->och_fh; CDEBUG(D_HA, "updating handle from "LPX64" to "LPX64"\n", file_fh->cookie, body->handle.cookie); memcpy(&old, file_fh, sizeof(old)); memcpy(file_fh, &body->handle, sizeof(*file_fh)); - } + } close_req = mod->mod_close_req; if (close_req != NULL) { @@ -584,7 +584,7 @@ int mdc_close(struct obd_export *exp, struct obdo *oa, mod->mod_close_req = req; if (mod->mod_open_req->rq_type == LI_POISON) { /* FIXME This should be an ASSERT, but until we - figure out why it can be poisoned here, give + figure out why it can be poisoned here, give a reasonable return. bug 6155 */ CERROR("LBUG POISONED open %p!\n", mod->mod_open_req); ptlrpc_req_finished(req); @@ -825,7 +825,7 @@ int mdc_set_info(struct obd_export *exp, obd_count keylen, ptlrpc_req_finished(req); RETURN(rc); } - + RETURN(rc); } @@ -979,8 +979,7 @@ int mdc_sync(struct obd_export *exp, struct ll_fid *fid, RETURN(rc); } -static int mdc_import_event(struct obd_device *obd, - struct obd_import *imp, +static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, enum obd_import_event event) { int rc = 0; @@ -992,8 +991,7 @@ static int mdc_import_event(struct obd_device *obd, break; } case IMP_EVENT_INACTIVE: { - if (obd->obd_observer) - rc = obd_notify(obd->obd_observer, obd, 0); + rc = obd_notify_observer(obd, obd, OBD_NOTIFY_INACTIVE); break; } case IMP_EVENT_INVALIDATE: { @@ -1004,12 +1002,14 @@ static int mdc_import_event(struct obd_device *obd, break; } case IMP_EVENT_ACTIVE: { - if (obd->obd_observer) - rc = obd_notify(obd->obd_observer, obd, 1); + rc = obd_notify_observer(obd, obd, OBD_NOTIFY_ACTIVE); break; } + case IMP_EVENT_OCD: + break; + default: - CERROR("Unknown import event %d\n", event); + CERROR("Unknown import event %x\n", event); LBUG(); } RETURN(rc); @@ -1096,8 +1096,8 @@ static int mdc_precleanup(struct obd_device *obd, int stage) { int rc = 0; ENTRY; - - if (stage < 2) + + if (stage < OBD_CLEANUP_SELF_EXP) RETURN(0); rc = obd_llog_finish(obd, 0); diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 5d3a736..cd25591 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -58,6 +58,7 @@ #include #include #include +#include #include "mds_internal.h" @@ -189,16 +190,56 @@ struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid, RETURN(retval); } -/* Look up an entry by inode number in mds obd */ +/* Look up an entry by inode number. */ +/* this function ONLY returns valid dget'd dentries with an initialized inode + or errors */ struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid, struct vfsmount **mnt) { + char fid_name[32]; + unsigned long ino = fid->id; + __u32 generation = fid->generation; + struct inode *inode; struct dentry *result; - CDEBUG(D_DENTRY, "--> mds_fid2dentry: ino/gen %lu/%u, sb %p\n", - (unsigned long)fid->id, fid->generation, mds->mds_sb); + if (ino == 0) + RETURN(ERR_PTR(-ESTALE)); - result = ll_fid2dentry(mds->mds_fid_de, fid->id, fid->generation); + snprintf(fid_name, sizeof(fid_name), "0x%lx", ino); + + CDEBUG(D_DENTRY, "--> mds_fid2dentry: ino/gen %lu/%u, sb %p\n", + ino, generation, mds->mds_sb); + + /* under ext3 this is neither supposed to return bad inodes + nor NULL inodes. */ + result = ll_lookup_one_len(fid_name, mds->mds_fid_de, strlen(fid_name)); + if (IS_ERR(result)) + RETURN(result); + + inode = result->d_inode; + if (!inode) + RETURN(ERR_PTR(-ENOENT)); + + if (inode->i_generation == 0 || inode->i_nlink == 0) { + LCONSOLE_WARN("Found inode with zero generation or link -- this" + " may indicate disk corruption (inode: %lu, link:" + " %lu, count: %d)\n", inode->i_ino, + (unsigned long)inode->i_nlink, + atomic_read(&inode->i_count)); + dput(result); + RETURN(ERR_PTR(-ENOENT)); + } + + if (generation && inode->i_generation != generation) { + /* we didn't find the right inode.. */ + CDEBUG(D_INODE, "found wrong generation: inode %lu, link: %lu, " + "count: %d, generation %u/%u\n", inode->i_ino, + (unsigned long)inode->i_nlink, + atomic_read(&inode->i_count), inode->i_generation, + generation); + dput(result); + RETURN(ERR_PTR(-ENOENT)); + } if (mnt) { *mnt = mds->mds_vfsmnt; @@ -254,6 +295,7 @@ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd, if (data != NULL) { data->ocd_connect_flags &= MDS_CONNECT_SUPPORTED; exp->exp_connect_flags = data->ocd_connect_flags; + data->ocd_version = LUSTRE_VERSION_CODE; } OBD_ALLOC(mcd, sizeof(*mcd)); @@ -282,7 +324,7 @@ out: RETURN(rc); } -static int mds_init_export(struct obd_export *exp) +static int mds_init_export(struct obd_export *exp) { struct mds_export_data *med = &exp->exp_mds_data; @@ -458,7 +500,7 @@ int mds_pack_md(struct obd_device *obd, struct lustre_msg *msg, int offset, inode->i_ino, lmm_size, mds->mds_max_mdsize); // RETURN(-EINVAL); } - + rc = mds_get_md(obd, inode, lmm, &lmm_size, lock); if (rc > 0) { if (S_ISDIR(inode->i_mode)) @@ -496,7 +538,7 @@ static int mds_getattr_internal(struct obd_device *obd, struct dentry *dentry, inode, 1); /* If we have LOV EA data, the OST holds size, atime, mtime */ - if (!(body->valid & OBD_MD_FLEASIZE) && + if (!(body->valid & OBD_MD_FLEASIZE) && !(body->valid & OBD_MD_FLDIREA)) body->valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLATIME | OBD_MD_FLMTIME); @@ -589,7 +631,7 @@ static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode, return(rc); } -static int mds_getattr_name(int offset, struct ptlrpc_request *req, int flags, +static int mds_getattr_name(int offset, struct ptlrpc_request *req, struct lustre_handle *child_lockh) { struct obd_device *obd = req->rq_export->exp_obd; @@ -671,8 +713,7 @@ static int mds_getattr_name(int offset, struct ptlrpc_request *req, int flags, rc = mds_get_parent_child_locked(obd, &obd->u.mds, &body->fid1, &parent_lockh, &dparent, LCK_PR, name, namesize, - child_lockh, &dchild, LCK_PR, - flags); + child_lockh, &dchild, LCK_PR); if (rc) GOTO(cleanup, rc); } else { @@ -1167,7 +1208,7 @@ int mds_handle(struct ptlrpc_request *req) * want to cancel. */ lockh.cookie = 0; - rc = mds_getattr_name(0, req, 0, &lockh); + rc = mds_getattr_name(0, req, &lockh); /* this non-intent call (from an ioctl) is special */ req->rq_status = rc; if (rc == 0 && lockh.cookie) @@ -1463,7 +1504,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) CDEBUG(D_SUPER, "%s: mnt = %p\n", lustre_cfg_string(lcfg, 1), mnt); LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb))); - + sema_init(&mds->mds_orphan_recovery_sem, 1); sema_init(&mds->mds_epoch_sem, 1); spin_lock_init(&mds->mds_transno_lock); @@ -1501,6 +1542,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) strncpy(mds->mds_profile, lustre_cfg_string(lcfg, 3), LUSTRE_CFG_BUFLEN(lcfg, 3)); + } ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL, @@ -1516,8 +1558,8 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) mds_quota_setup(mds); - /* Wait for mds_postrecov trying to clear orphans until 9439 is fixed */ - obd->obd_async_recov = 0; + /* Don't wait for mds_postrecov trying to clear orphans */ + obd->obd_async_recov = 1; rc = mds_postsetup(obd); if (rc) GOTO(err_fs, rc); @@ -1536,7 +1578,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) obd->obd_name, lustre_cfg_string(lcfg, 1), obd->obd_recoverable_clients, - (obd->obd_recoverable_clients == 1) + (obd->obd_recoverable_clients == 1) ? "client" : "clients", (int)(OBD_RECOVERY_TIMEOUT / HZ) / 60, (int)(OBD_RECOVERY_TIMEOUT / HZ) % 60, @@ -1576,6 +1618,36 @@ err_put: return rc; } +static int mds_lov_clean(struct obd_device *obd) +{ + struct mds_obd *mds = &obd->u.mds; + struct obd_device *osc = mds->mds_osc_obd; + ENTRY; + + if (mds->mds_profile) { + class_del_profile(mds->mds_profile); + OBD_FREE(mds->mds_profile, strlen(mds->mds_profile) + 1); + mds->mds_profile = NULL; + } + + /* There better be a lov */ + if (!osc) + RETURN(0); + + obd_register_observer(osc, NULL); + + /* Give lov our same shutdown flags */ + osc->obd_force = obd->obd_force; + osc->obd_fail = obd->obd_fail; + + /* Cleanup the lov */ + obd_disconnect(mds->mds_osc_exp); + class_manual_cleanup(osc); + mds->mds_osc_exp = NULL; + + RETURN(0); +} + static int mds_postsetup(struct obd_device *obd) { struct mds_obd *mds = &obd->u.mds; @@ -1650,7 +1722,7 @@ int mds_postrecov(struct obd_device *obd) int rc, item = 0; ENTRY; - if (obd->obd_fail) + if (obd->obd_fail) RETURN(0); LASSERT(!obd->obd_recovering); @@ -1679,34 +1751,17 @@ out: RETURN(rc < 0 ? rc : item); } -int mds_lov_clean(struct obd_device *obd) +/* We need to be able to stop an mds_lov_synchronize */ +static int mds_lov_early_clean(struct obd_device *obd) { struct mds_obd *mds = &obd->u.mds; struct obd_device *osc = mds->mds_osc_obd; - ENTRY; - - if (mds->mds_profile) { - class_del_profile(mds->mds_profile); - OBD_FREE(mds->mds_profile, strlen(mds->mds_profile) + 1); - mds->mds_profile = NULL; - } - - /* There better be a lov */ - if (!osc) - RETURN(0); - obd_register_observer(osc, NULL); + if (!osc || (!obd->obd_force && !obd->obd_fail)) + return(0); - /* Give lov our same shutdown flags */ - osc->obd_force = obd->obd_force; - osc->obd_fail = obd->obd_fail; - - /* Cleanup the lov */ - obd_disconnect(mds->mds_osc_exp); - class_manual_cleanup(osc); - mds->mds_osc_exp = NULL; - - RETURN(0); + CDEBUG(D_HA, "abort inflight\n"); + return (obd_precleanup(osc, OBD_CLEANUP_EARLY)); } static int mds_precleanup(struct obd_device *obd, int stage) @@ -1715,10 +1770,12 @@ static int mds_precleanup(struct obd_device *obd, int stage) ENTRY; switch (stage) { - case 1: + case OBD_CLEANUP_EXPORTS: target_cleanup_recovery(obd); + mds_lov_early_clean(obd); break; - case 2: + case OBD_CLEANUP_SELF_EXP: + mds_lov_disconnect(obd); mds_lov_clean(obd); llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT)); rc = obd_llog_finish(obd, 0); @@ -1832,7 +1889,7 @@ static void fixup_handle_for_resent_req(struct ptlrpc_request *req, /* If the xid matches, then we know this is a resent request, * and allow it. (It's probably an OPEN, for which we don't * send a lock */ - if (req->rq_xid == + if (req->rq_xid == le64_to_cpu(exp->exp_mds_data.med_mcd->mcd_last_xid)) return; @@ -1919,7 +1976,7 @@ static int mds_intent_policy(struct ldlm_namespace *ns, RETURN(ELDLM_LOCK_ABORTED); if (intent_disposition(rep, DISP_LOOKUP_NEG) && !intent_disposition(rep, DISP_OPEN_OPEN)) -#endif +#endif RETURN(ELDLM_LOCK_ABORTED); break; case IT_GETATTR: @@ -1927,8 +1984,7 @@ static int mds_intent_policy(struct ldlm_namespace *ns, case IT_READDIR: fixup_handle_for_resent_req(req, lock, &new_lock, &lockh); rep->lock_policy_res2 = mds_getattr_name(offset, req, - flags & LDLM_INHERIT_FLAGS, - &lockh); + &lockh); /* FIXME: LDLM can set req->rq_status. MDS sets policy_res{1,2} with disposition and status. - replay: returns 0 & req->status is old status @@ -2023,8 +2079,8 @@ static int mdt_setup(struct obd_device *obd, obd_count len, void *buf) ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE, MDS_MAXREPSIZE, MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_TIMEOUT, - mds_handle, "mds", obd->obd_proc_entry, NULL, - MDT_NUM_THREADS); + mds_handle, LUSTRE_MDS_NAME, + obd->obd_proc_entry, NULL, MDT_NUM_THREADS); if (!mds->mds_service) { CERROR("failed to start service\n"); @@ -2107,7 +2163,7 @@ static int mdt_health_check(struct obd_device *obd) { struct mds_obd *mds = &obd->u.mds; int rc = 0; - + down(&mds->mds_health_sem); rc |= ptlrpc_service_health_check(mds->mds_readpage_service); rc |= ptlrpc_service_health_check(mds->mds_setattr_service); @@ -2120,7 +2176,7 @@ static int mdt_health_check(struct obd_device *obd) */ if(rc != 0) rc = 1; - + return rc; } @@ -2134,6 +2190,19 @@ static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr, fid.generation = gen; return mds_fid2dentry(&obd->u.mds, &fid, NULL); } +static int mds_health_check(struct obd_device *obd) +{ + struct mds_obd *mds = &obd->u.mds; + int rc = 0; + + if (mds->mds_sb->s_flags & MS_RDONLY) + rc = 1; + + LASSERT(mds->mds_health_check_filp != NULL); + rc |= !!lvfs_check_io_health(obd, mds->mds_health_check_filp); + + return rc; +} struct lvfs_callback_ops mds_lvfs_ops = { l_fid2dentry: mds_lvfs_fid2dentry, @@ -2157,6 +2226,7 @@ static struct obd_ops mds_obd_ops = { .o_llog_init = mds_llog_init, .o_llog_finish = mds_llog_finish, .o_notify = mds_notify, + .o_health_check = mds_health_check, }; static struct obd_ops mdt_obd_ops = { diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 21783a8..4b42c7e 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -55,6 +55,7 @@ #define LAST_RCVD "last_rcvd" #define LOV_OBJID "lov_objid" +#define HEALTH_CHECK "health_check" /* Add client data to the MDS. We use a bitmap to locate a free space * in the last_rcvd file if cl_off is -1 (i.e. a new client). @@ -531,11 +532,32 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt) file->f_dentry->d_inode->i_mode); GOTO(err_lov_objid, rc = -ENOENT); } + + /* open and test the check io file junk */ + file = filp_open(HEALTH_CHECK, O_RDWR | O_CREAT, 0644); + if (IS_ERR(file)) { + rc = PTR_ERR(file); + CERROR("cannot open/create %s file: rc = %d\n", HEALTH_CHECK, rc); + GOTO(err_lov_objid, rc = PTR_ERR(file)); + } + mds->mds_health_check_filp = file; + if (!S_ISREG(file->f_dentry->d_inode->i_mode)) { + CERROR("%s is not a regular file!: mode = %o\n", HEALTH_CHECK, + file->f_dentry->d_inode->i_mode); + GOTO(err_health_check, rc = -ENOENT); + } + rc = lvfs_check_io_health(obd, file); + if (rc) + GOTO(err_health_check, rc); err_pop: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); return rc; +err_health_check: + if (mds->mds_health_check_filp && + filp_close(mds->mds_health_check_filp, 0)) + CERROR("can't close %s after error\n", HEALTH_CHECK); err_lov_objid: if (mds->mds_lov_objid_filp && filp_close(mds->mds_lov_objid_filp, 0)) CERROR("can't close %s after error\n", LOV_OBJID); @@ -582,6 +604,12 @@ int mds_fs_cleanup(struct obd_device *obd) if (rc) CERROR("%s file won't close, rc=%d\n", LOV_OBJID, rc); } + if (mds->mds_health_check_filp) { + rc = filp_close(mds->mds_health_check_filp, 0); + mds->mds_health_check_filp = NULL; + if (rc) + CERROR("%s file won't close, rc=%d\n", HEALTH_CHECK, rc); + } if (mds->mds_objects_dir != NULL) { l_dput(mds->mds_objects_dir); mds->mds_objects_dir = NULL; diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 32c9fb1..3538708 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -103,8 +103,7 @@ int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2); int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id, struct lustre_handle *p1_lockh, int p1_lock_mode, struct ldlm_res_id *p2_res_id, - struct lustre_handle *p2_lockh, int p2_lock_mode, - int p2_lock_flags); + struct lustre_handle *p2_lockh, int p2_lock_mode); void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error); int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, struct ptlrpc_request *req, int rc, __u32 op_data); @@ -116,8 +115,7 @@ int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds, struct dentry **dparentp, int parent_mode, char *name, int namelen, struct lustre_handle *child_lockh, - struct dentry **dchildp, int child_mode, - int child_lock_flags); + struct dentry **dchildp, int child_mode); int mds_lock_new_child(struct obd_device *obd, struct inode *inode, struct lustre_handle *child_lockh); int mds_osc_setattr_async(struct obd_device *obd, struct inode *inode, @@ -148,6 +146,7 @@ int mds_llog_finish(struct obd_device *obd, int count); /* mds/mds_lov.c */ int mds_lov_connect(struct obd_device *obd, char * lov_name); +int mds_lov_disconnect(struct obd_device *obd); int mds_lov_write_objids(struct obd_device *obd); void mds_lov_update_objids(struct obd_device *obd, obd_id *ids); int mds_lov_set_nextid(struct obd_device *obd); @@ -155,7 +154,8 @@ int mds_lov_clearorphans(struct mds_obd *mds, struct obd_uuid *ost_uuid); int mds_lov_start_synchronize(struct obd_device *obd, struct obd_uuid *uuid, int nonblock); int mds_post_mds_lovconf(struct obd_device *obd); -int mds_notify(struct obd_device *obd, struct obd_device *watched, int active); +int mds_notify(struct obd_device *obd, struct obd_device *watched, + enum obd_notify_event ev); int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode, struct lov_mds_md *lmm, int lmm_size); void mds_objids_from_lmm(obd_id *ids, struct lov_mds_md *lmm, @@ -184,7 +184,6 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa, /* mds/handler.c */ extern struct lvfs_callback_ops mds_lvfs_ops; -int mds_lov_clean(struct obd_device *obd); extern int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg); int mds_postrecov(struct obd_device *obd); diff --git a/lustre/mds/mds_lib.c b/lustre/mds/mds_lib.c index 2047fdb..16e4127 100644 --- a/lustre/mds/mds_lib.c +++ b/lustre/mds/mds_lib.c @@ -366,6 +366,8 @@ int mds_init_ucred(struct lvfs_ucred *ucred, struct ptlrpc_request *req, #if CRAY_XT3 ucred->luc_fsuid = req->rq_uid; + if (req->rq_uid == 0) /* allow root to keep capabilities, bug 7305 */ + ucred->luc_cap = body->capability; #else ucred->luc_fsuid = body->fsuid; ucred->luc_fsgid = body->fsgid; diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index a04ea6d..d655273 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -244,6 +244,27 @@ err_discon: RETURN(rc); } +int mds_lov_disconnect(struct obd_device *obd) +{ + struct mds_obd *mds = &obd->u.mds; + int rc = 0; + ENTRY; + + if (!IS_ERR(mds->mds_osc_obd) && mds->mds_osc_exp != NULL) { + obd_register_observer(mds->mds_osc_obd, NULL); + + /* The actual disconnect of the mds_lov will be called from + * class_disconnect_exports from mds_lov_clean. So we have to + * ensure that class_cleanup doesn't fail due to the extra ref + * we're holding now. The mechanism to do that already exists - + * the obd_force flag. We'll drop the final ref to the + * mds_osc_exp in mds_cleanup. */ + mds->mds_osc_obd->obd_force = 1; + } + + RETURN(rc); +} + int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg) { @@ -475,7 +496,10 @@ static int __mds_lov_syncronize(void *data) CWARN("MDS %s: %s now active, resetting orphans\n", obd->obd_name, uuid ? (char *)uuid->uuid : "All OSC's"); - + + if (obd->obd_stopping) + GOTO(out, rc = -ENODEV); + rc = mds_lov_clearorphans(&obd->u.mds, uuid); if (rc != 0) { CERROR("%s: failed at mds_lov_clearorphans: %d\n", @@ -484,7 +508,7 @@ static int __mds_lov_syncronize(void *data) } out: - class_export_put(obd->obd_self_export); + class_decref(obd); RETURN(rc); } @@ -518,9 +542,16 @@ int mds_lov_start_synchronize(struct obd_device *obd, struct obd_uuid *uuid, mlsi->mlsi_obd = obd; mlsi->mlsi_uuid = uuid; - - /* We need to lock the mds in place for our new thread context. */ - class_export_get(obd->obd_self_export); + + /* Although class_export_get(obd->obd_self_export) would lock + the MDS in place, since it's only a self-export + it doesn't lock the LOV in place. The LOV can be disconnected + during MDS precleanup, leaving nothing for __mds_lov_syncronize. + Simply taking an export ref on the LOV doesn't help, because it's + still disconnected. Taking an obd reference insures that we don't + disconnect the LOV. This of course means a cleanup won't + finish for as long as the sync is blocking. */ + atomic_inc(&obd->obd_refcount); if (nonblock) { /* Syncronize in the background */ @@ -541,16 +572,17 @@ int mds_lov_start_synchronize(struct obd_device *obd, struct obd_uuid *uuid, RETURN(rc); } -int mds_notify(struct obd_device *obd, struct obd_device *watched, int active) +int mds_notify(struct obd_device *obd, struct obd_device *watched, + enum obd_notify_event ev) { struct obd_uuid *uuid; int rc = 0; ENTRY; - if (!active) + if (ev != OBD_NOTIFY_ACTIVE) RETURN(0); - if (strcmp(watched->obd_type->typ_name, "osc")) { + if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) { CERROR("unexpected notification of %s %s!\n", watched->obd_type->typ_name, watched->obd_name); RETURN(-EINVAL); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index f4c25bc..93d020b 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1008,10 +1008,6 @@ int mds_open(struct mds_update_record *rec, int offset, (acc_mode & MAY_WRITE)) GOTO(cleanup, rc = -EROFS); - /* Can't write to a read-only file */ - if (IS_RDONLY(dchild->d_inode) && (acc_mode & MAY_WRITE) != 0) - GOTO(cleanup, rc = -EPERM); - /* An append-only file must be opened in append mode for * writing */ if (IS_APPEND(dchild->d_inode) && (acc_mode & MAY_WRITE) != 0 && @@ -1087,9 +1083,9 @@ int mds_open(struct mds_update_record *rec, int offset, else ptlrpc_save_lock (req, &parent_lockh, parent_mode); } - + /* trigger dqacq on the owner of child and parent */ - mds_adjust_qunit(obd, current->fsuid, current->fsgid, + mds_adjust_qunit(obd, current->fsuid, current->fsgid, parent_uid, parent_gid, rc); RETURN(rc); } diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index a0497cb..71c3e0e 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -694,7 +694,7 @@ static int mds_reint_create(struct mds_update_record *rec, int offset, ENTRY; LASSERT(offset == 0); - LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name, + LASSERT(!strcmp(req->rq_export->exp_obd->obd_type->typ_name, LUSTRE_MDS_NAME)); DEBUG_REQ(D_INODE, req, "parent "LPU64"/%u name %s mode %o", @@ -946,13 +946,12 @@ int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2) int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id, struct lustre_handle *p1_lockh, int p1_lock_mode, struct ldlm_res_id *p2_res_id, - struct lustre_handle *p2_lockh, int p2_lock_mode, - int p2_lock_flags) + struct lustre_handle *p2_lockh, int p2_lock_mode) { struct ldlm_res_id *res_id[2] = { p1_res_id, p2_res_id }; struct lustre_handle *handles[2] = { p1_lockh, p2_lockh }; int lock_modes[2] = { p1_lock_mode, p2_lock_mode }; - int flags[2] = { LDLM_FL_LOCAL_ONLY, LDLM_FL_LOCAL_ONLY | p2_lock_flags }; + int flags = LDLM_FL_LOCAL_ONLY; int rc; ENTRY; @@ -968,15 +967,13 @@ int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id, res_id[0] = p2_res_id; lock_modes[1] = p1_lock_mode; lock_modes[0] = p2_lock_mode; - flags[1] = LDLM_FL_LOCAL_ONLY; - flags[0] = p2_lock_flags | LDLM_FL_LOCAL_ONLY; } CDEBUG(D_DLMTRACE, "lock order: "LPU64"/"LPU64"\n", res_id[0]->name[0], res_id[1]->name[0]); rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace, *res_id[0], - LDLM_PLAIN, NULL, lock_modes[0], &flags[0], + LDLM_PLAIN, NULL, lock_modes[0], &flags, ldlm_blocking_ast, ldlm_completion_ast, NULL, NULL, NULL, 0, NULL, handles[0]); if (rc != ELDLM_OK) @@ -989,7 +986,7 @@ int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id, } else if (res_id[1]->name[0] != 0) { rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace, *res_id[1], LDLM_PLAIN, NULL, - lock_modes[1], &flags[1], + lock_modes[1], &flags, ldlm_blocking_ast, ldlm_completion_ast, NULL, NULL, NULL, 0, NULL, handles[1]); if (rc != ELDLM_OK) { @@ -1180,8 +1177,7 @@ int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds, struct dentry **dparentp, int parent_mode, char *name, int namelen, struct lustre_handle *child_lockh, - struct dentry **dchildp, int child_mode, - int child_lock_flags) + struct dentry **dchildp, int child_mode) { struct ldlm_res_id child_res_id = { .name = {0} }; struct ldlm_res_id parent_res_id = { .name = {0} }; @@ -1236,8 +1232,7 @@ retry_locks: /* Step 3: Lock parent and child in resource order. If child doesn't * exist, we still have to lock the parent and re-lookup. */ rc = enqueue_ordered_locks(obd,&parent_res_id,parent_lockh,parent_mode, - &child_res_id, child_lockh, child_mode, - child_lock_flags); + &child_res_id, child_lockh, child_mode); if (rc) GOTO(cleanup, rc); @@ -1390,7 +1385,7 @@ static int mds_reint_unlink(struct mds_update_record *rec, int offset, rc = mds_get_parent_child_locked(obd, mds, rec->ur_fid1, &parent_lockh, &dparent, LCK_PW, rec->ur_name, rec->ur_namelen, - &child_lockh, &dchild, LCK_EX, 0); + &child_lockh, &dchild, LCK_EX); if (rc) GOTO(cleanup, rc); @@ -1639,7 +1634,7 @@ static int mds_reint_link(struct mds_update_record *rec, int offset, tgt_dir_res_id.name[1] = de_tgt_dir->d_inode->i_generation; rc = enqueue_ordered_locks(obd, &src_res_id, &src_lockh, LCK_EX, - &tgt_dir_res_id, &tgt_dir_lockh, LCK_EX, 0); + &tgt_dir_res_id, &tgt_dir_lockh, LCK_EX); if (rc) GOTO(cleanup, rc); diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 9eb183c..b68223d 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -419,6 +419,7 @@ EXPORT_SYMBOL(class_handle_unhash); EXPORT_SYMBOL(class_handle2object); /* config.c */ +EXPORT_SYMBOL(class_decref); EXPORT_SYMBOL(class_get_profile); EXPORT_SYMBOL(class_del_profile); EXPORT_SYMBOL(class_process_config); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 9e10b18..dc0e8fb 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -630,6 +630,7 @@ int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats) LPROCFS_OBD_OP_INIT(num_private_stats, stats, add_conn); LPROCFS_OBD_OP_INIT(num_private_stats, stats, del_conn); LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect); + LPROCFS_OBD_OP_INIT(num_private_stats, stats, reconnect); LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect); LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs); LPROCFS_OBD_OP_INIT(num_private_stats, stats, packmd); diff --git a/lustre/obdclass/lustre_handles.c b/lustre/obdclass/lustre_handles.c index f3626b2..ef7639d 100644 --- a/lustre/obdclass/lustre_handles.c +++ b/lustre/obdclass/lustre_handles.c @@ -27,9 +27,9 @@ #ifdef __KERNEL__ # include # include -#else +#else # include -#endif +#endif #include #include @@ -43,6 +43,10 @@ static int handle_count = 0; #define HANDLE_HASH_SIZE (1 << 14) #define HANDLE_HASH_MASK (HANDLE_HASH_SIZE - 1) +/* + * Generate a unique 64bit cookie (hash) for a handle and insert it into + * global (per-node) hash-table. + */ void class_handle_hash(struct portals_handle *h, portals_handle_addref_cb cb) { struct list_head *bucket; @@ -52,19 +56,33 @@ void class_handle_hash(struct portals_handle *h, portals_handle_addref_cb cb) LASSERT(list_empty(&h->h_link)); spin_lock(&handle_lock); + + /* + * This is fast, but simplistic cookie generation algorithm, it will + * need a re-do at some point in the future for security. + */ h->h_cookie = handle_base; handle_base += HANDLE_INCR; - spin_unlock(&handle_lock); - h->h_addref = cb; bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK); - CDEBUG(D_INFO, "adding object %p with handle "LPX64" to hash\n", - h, h->h_cookie); - - spin_lock(&handle_lock); list_add(&h->h_link, bucket); handle_count++; + + if (unlikely(handle_base == 0)) { + /* + * Cookie of zero is "dangerous", because in many places it's + * assumed that 0 means "unassigned" handle, not bound to any + * object. + */ + CWARN("The universe has been exhausted: cookie wrap-around.\n"); + handle_base += HANDLE_INCR; + } + spin_unlock(&handle_lock); + + h->h_addref = cb; + CDEBUG(D_INFO, "added object %p with handle "LPX64" to hash\n", + h, h->h_cookie); EXIT; } diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 2f12981..0055635 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -73,6 +73,26 @@ int class_attach(struct lustre_cfg *lcfg) CDEBUG(D_IOCTL, "attach type %s name: %s uuid: %s\n", MKSTR(typename), MKSTR(name), MKSTR(uuid)); + + /* Mountconf transitional hack, should go away after 1.6. + 1.4.7 uses the old names, so translate back if the + mountconf flag is set. + 1.6 should set this flag, and translate the other way here + if not set. */ + if (lcfg->lcfg_flags & LCFG_FLG_MOUNTCONF){ + char *tmp = NULL; + if (strcmp(typename, "mds") == 0) + tmp = "mdt"; + if (strcmp(typename, "mdt") == 0) + tmp = "mds"; + if (strcmp(typename, "osd") == 0) + tmp = "obdfilter"; + if (tmp) { + LCONSOLE_WARN("Using type %s for %s %s\n", tmp, + MKSTR(typename), MKSTR(name)); + typename = tmp; + } + } /* find the type */ type = class_get_type(typename); @@ -361,7 +381,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) /* Precleanup stage 1, we must make sure all exports (other than the self-export) get destroyed. */ - err = obd_precleanup(obd, 1); + err = obd_precleanup(obd, OBD_CLEANUP_EXPORTS); if (err) CERROR("Precleanup %s returned %d\n", obd->obd_name, err); @@ -396,7 +416,7 @@ void class_decref(struct obd_device *obd) /* if we're not stopping, we didn't finish setup */ /* Precleanup stage 2, do other type-specific cleanup requiring the self-export. */ - err = obd_precleanup(obd, 2); + err = obd_precleanup(obd, OBD_CLEANUP_SELF_EXP); if (err) CERROR("Precleanup %s returned %d\n", obd->obd_name, err); @@ -468,8 +488,8 @@ int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg) CERROR("invalid conn_uuid\n"); RETURN(-EINVAL); } - if (strcmp(obd->obd_type->typ_name, "mdc") && - strcmp(obd->obd_type->typ_name, "osc")) { + if (strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) && + strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME)) { CERROR("can't del connection on non-client dev\n"); RETURN(-EINVAL); } @@ -622,6 +642,11 @@ int class_process_config(struct lustre_cfg *lcfg) sizeof (obd_lustre_upcall)); GOTO(out, err = 0); } + case LCFG_PARAM: + case LCFG_MARKER: { + LCONSOLE_WARN("LCFG_MARKER not yet implemented.\n"); + GOTO(out, err = 0); + } } /* Commands that require a device */ @@ -855,7 +880,7 @@ void class_manual_cleanup(struct obd_device *obd) int err; char flags[3]=""; ENTRY; - + if (!obd) { CERROR("empty cleanup\n"); EXIT; @@ -867,22 +892,22 @@ void class_manual_cleanup(struct obd_device *obd) if (obd->obd_fail) strcat(flags, "A"); - CDEBUG(D_CONFIG, "Manual cleanup of %s (flags='%s')\n", + CDEBUG(D_CONFIG, "Manual cleanup of %s (flags='%s')\n", obd->obd_name, flags); lustre_cfg_bufs_reset(&bufs, obd->obd_name); lustre_cfg_bufs_set_string(&bufs, 1, flags); lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs); - + err = class_process_config(lcfg); - if (err) + if (err) CERROR("cleanup failed %d: %s\n", err, obd->obd_name); - + /* the lcfg is almost the same for both ops */ lcfg->lcfg_command = LCFG_DETACH; err = class_process_config(lcfg); lustre_cfg_free(lcfg); - if (err) + if (err) CERROR("detach failed %d: %s\n", err, obd->obd_name); EXIT; } diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index f54d94d..1fada17 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -261,7 +261,7 @@ static int parse_disk_data(struct lvfs_run_ctxt *mount_ctxt, len = file->f_dentry->d_inode->i_size; CDEBUG(D_MOUNT, "Have %s, size %lu\n", MOUNT_DATA_FILE, len); if (len != sizeof(*ldd)) { - CERROR("disk data size does not match: see %lu expect %lu\n", + CERROR("disk data size does not match: see %lu expect %u\n", len, sizeof(*ldd)); GOTO(out_close, err = -EINVAL); } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index eb5641f..66efd3c 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -777,7 +778,7 @@ static int filter_prep(struct obd_device *obd) LAST_RCVD, rc); GOTO(out, rc); } - + filter->fo_rcvd_filp = file; if (!S_ISREG(file->f_dentry->d_inode->i_mode)) { CERROR("%s is not a regular file!: mode = %o\n", LAST_RCVD, file->f_dentry->d_inode->i_mode); @@ -795,12 +796,27 @@ static int filter_prep(struct obd_device *obd) CERROR("cannot read %s: rc = %d\n", LAST_RCVD, rc); GOTO(err_filp, rc); } - filter->fo_rcvd_filp = file; + /* open and create health check io file*/ + file = filp_open(HEALTH_CHECK, O_RDWR | O_CREAT, 0644); + if (IS_ERR(file)) { + rc = PTR_ERR(file); + CERROR("OBD filter: cannot open/create %s rc = %d\n", + HEALTH_CHECK, rc); + GOTO(err_filp, rc); + } + filter->fo_health_check_filp = file; + if (!S_ISREG(file->f_dentry->d_inode->i_mode)) { + CERROR("%s is not a regular file!: mode = %o\n", HEALTH_CHECK, + file->f_dentry->d_inode->i_mode); + GOTO(err_health_check, rc = -ENOENT); + } + rc = lvfs_check_io_health(obd, file); + if (rc) + GOTO(err_health_check, rc); rc = filter_prep_groups(obd); if (rc) GOTO(err_server_data, rc); - out: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); @@ -809,8 +825,12 @@ static int filter_prep(struct obd_device *obd) err_server_data: //class_disconnect_exports(obd, 0); filter_free_server_data(filter); + err_health_check: + if (filp_close(filter->fo_health_check_filp, 0)) + CERROR("can't close %s after error\n", HEALTH_CHECK); + filter->fo_health_check_filp = NULL; err_filp: - if (filp_close(file, 0)) + if (filp_close(filter->fo_rcvd_filp, 0)) CERROR("can't close %s after error\n", LAST_RCVD); filter->fo_rcvd_filp = NULL; goto out; @@ -845,6 +865,11 @@ static void filter_post(struct obd_device *obd) if (rc) CERROR("error closing %s: rc = %d\n", LAST_RCVD, rc); + rc = filp_close(filter->fo_health_check_filp, 0); + filter->fo_health_check_filp = NULL; + if (rc) + CERROR("error closing %s: rc = %d\n", HEALTH_CHECK, rc); + filter_cleanup_groups(obd); filter_free_server_data(filter); pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); @@ -1569,10 +1594,10 @@ static int filter_precleanup(struct obd_device *obd, int stage) ENTRY; switch(stage) { - case 1: + case OBD_CLEANUP_EXPORTS: target_cleanup_recovery(obd); break; - case 2: + case OBD_CLEANUP_SELF_EXP: rc = filter_llog_finish(obd, 0); } RETURN(rc); @@ -1636,7 +1661,6 @@ static int filter_cleanup(struct obd_device *obd) /* In case we didn't mount with lustre_get_mount -- old method*/ mntput(filter->fo_vfsmnt); - //destroy_buffers(filter->fo_sb->s_dev); filter->fo_sb = NULL; lvfs_clear_rdonly(save_dev); @@ -1653,6 +1677,54 @@ static int filter_cleanup(struct obd_device *obd) RETURN(0); } +static int filter_connect_internal(struct obd_export *exp, + struct obd_connect_data *data) +{ + if (data != NULL) { + CDEBUG(D_RPCTRACE, "%s: cli %s/%p ocd_connect_flags: "LPX64 + " ocd_version: %x ocd_grant: %d\n", + exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, + data->ocd_connect_flags, data->ocd_version, + data->ocd_grant); + + data->ocd_connect_flags &= OST_CONNECT_SUPPORTED; + exp->exp_connect_flags = data->ocd_connect_flags; + data->ocd_version = LUSTRE_VERSION_CODE; + + if (exp->exp_connect_flags & OBD_CONNECT_GRANT) { + obd_size left, want; + + spin_lock(&exp->exp_obd->obd_osfs_lock); + left = filter_grant_space_left(exp); + want = data->ocd_grant; + data->ocd_grant = filter_grant(exp, 0, want, left); + spin_unlock(&exp->exp_obd->obd_osfs_lock); + + CDEBUG(D_CACHE, "%s: cli %s/%p ocd_grant: %d want: " + "%lld left: %lld\n", exp->exp_obd->obd_name, + exp->exp_client_uuid.uuid, exp, + data->ocd_grant, want, left); + } + } + + RETURN(0); +} + +static int filter_reconnect(struct obd_export *exp, struct obd_device *obd, + struct obd_uuid *cluuid, + struct obd_connect_data *data) +{ + int rc; + ENTRY; + + if (exp == NULL || obd == NULL || cluuid == NULL) + RETURN(-EINVAL); + + rc = filter_connect_internal(exp, data); + + RETURN(rc); +} + /* nearly identical to mds_connect */ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, struct obd_uuid *cluuid,struct obd_connect_data *data) @@ -1674,12 +1746,6 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, LASSERT(exp != NULL); fed = &exp->exp_filter_data; - - if (data != NULL) { - data->ocd_connect_flags &= OST_CONNECT_SUPPORTED; - exp->exp_connect_flags = data->ocd_connect_flags; - } - spin_lock_init(&fed->fed_lock); if (!obd->obd_replayable) @@ -1695,6 +1761,9 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, fed->fed_fcd = fcd; rc = filter_client_add(obd, filter, fed, -1); + if (!rc) + filter_connect_internal(exp, data); + GOTO(cleanup, rc); cleanup: @@ -2202,10 +2271,9 @@ static int filter_statfs(struct obd_device *obd, struct obd_statfs *osfs, filter_grant_sanity_check(obd, __FUNCTION__); - osfs->os_bavail -= min(osfs->os_bavail, - (filter->fo_tot_dirty + filter->fo_tot_pending + - osfs->os_bsize - 1) >> blockbits); - + osfs->os_bavail -= min(osfs->os_bavail, GRANT_FOR_LLOG(obd) + + ((filter->fo_tot_dirty + filter->fo_tot_pending + + osfs->os_bsize - 1) >> blockbits)); RETURN(rc); } @@ -2556,9 +2624,11 @@ static int filter_truncate(struct obd_export *exp, struct obdo *oa, int error; ENTRY; - if (end != OBD_OBJECT_EOF) + if (end != OBD_OBJECT_EOF) { CERROR("PUNCH not supported, only truncate: end = "LPX64"\n", end); + RETURN(-EFAULT); + } CDEBUG(D_INODE, "calling truncate for object "LPU64", valid = "LPX64 ", o_size = "LPD64"\n", oa->o_id, oa->o_valid, start); @@ -2764,9 +2834,12 @@ static int filter_health_check(struct obd_device *obd) * health_check to return 0 on healthy * and 1 on unhealthy. */ - if(filter->fo_sb->s_flags & MS_RDONLY) + if (filter->fo_sb->s_flags & MS_RDONLY) rc = 1; + LASSERT(filter->fo_health_check_filp != NULL); + rc |= !!lvfs_check_io_health(obd, filter->fo_health_check_filp); + return rc; } @@ -2788,6 +2861,7 @@ static struct obd_ops filter_obd_ops = { .o_precleanup = filter_precleanup, .o_cleanup = filter_cleanup, .o_connect = filter_connect, + .o_reconnect = filter_reconnect, .o_disconnect = filter_disconnect, .o_statfs = filter_statfs, .o_getattr = filter_getattr, @@ -2817,6 +2891,7 @@ static struct obd_ops filter_sanobd_ops = { .o_precleanup = filter_precleanup, .o_cleanup = filter_cleanup, .o_connect = filter_connect, + .o_reconnect = filter_reconnect, .o_disconnect = filter_disconnect, .o_statfs = filter_statfs, .o_getattr = filter_getattr, diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index d431bfc..9f86d09 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -23,6 +23,7 @@ #endif #define LAST_RCVD "last_rcvd" +#define HEALTH_CHECK "health_check" #define FILTER_INIT_OBJID 0 #define FILTER_LR_SERVER_SIZE 512 @@ -44,6 +45,7 @@ #define FILTER_INCOMPAT_SUPP (FILTER_INCOMPAT_GROUPS) #define FILTER_GRANT_CHUNK (2ULL * PTLRPC_MAX_BRW_SIZE) +#define GRANT_FOR_LLOG(obd) 16 /* Data stored per client in the last_rcvd file. In le32 order. */ struct filter_client_data { diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 0f89961..7d1702a 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -142,8 +142,6 @@ static void filter_grant_incoming(struct obd_export *exp, struct obdo *oa) EXIT; } -#define GRANT_FOR_LLOG(obd) 16 - /* Figure out how much space is available between what we've granted * and what remains in the filesystem. Compensate for ext3 indirect * block overhead when computing how much free space is left ungranted. @@ -182,7 +180,7 @@ restat: if (left >= tot_granted) { left -= tot_granted; } else { - if (left < tot_granted - obd->u.filter.fo_tot_pending + 65536) { + if (left < tot_granted - obd->u.filter.fo_tot_pending) { CERROR("%s: cli %s/%p grant "LPU64" > available " LPU64" and pending "LPU64"\n", obd->obd_name, exp->exp_client_uuid.uuid, exp, tot_granted, @@ -228,12 +226,16 @@ long filter_grant(struct obd_export *exp, obd_size current_grant, obd->obd_name, exp->exp_client_uuid.uuid, exp, want); } else if (current_grant < want && current_grant < fed->fed_grant + FILTER_GRANT_CHUNK) { - grant = min((want >> blockbits) / 2, + grant = min((want >> blockbits), (fs_space_left >> blockbits) / 8); grant <<= blockbits; if (grant) { - if (grant > FILTER_GRANT_CHUNK) + /* Allow >FILTER_GRANT_CHUNK size when clients + * reconnect due to a server reboot. + */ + if ((grant > FILTER_GRANT_CHUNK) && + (!obd->obd_recovering)) grant = FILTER_GRANT_CHUNK; obd->u.filter.fo_tot_granted += grant; @@ -435,7 +437,7 @@ static int filter_grant_check(struct obd_export *exp, int objcount, * marked BRW_GRANTED are already mapped and we can * ignore this error. */ lnb[n].rc = -ENOSPC; - rnb[n].flags &= OBD_BRW_GRANTED; + rnb[n].flags &= ~OBD_BRW_GRANTED; CDEBUG(D_CACHE,"%s: cli %s/%p idx %d no space for %d\n", exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, n, bytes); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 7f7d6d6..1628aad 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -624,6 +624,17 @@ void osc_wake_cache_waiters(struct client_obd *cli) EXIT; } +static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) +{ + spin_lock(&cli->cl_loi_list_lock); + cli->cl_avail_grant = ocd->ocd_grant; + spin_unlock(&cli->cl_loi_list_lock); + + CDEBUG(D_CACHE, "setting cl_avail_grant: %ld cl_lost_grant: %ld\n", + cli->cl_avail_grant, cli->cl_lost_grant); + LASSERT(cli->cl_avail_grant >= 0); +} + static void osc_update_grant(struct client_obd *cli, struct ost_body *body) { spin_lock(&cli->cl_loi_list_lock); @@ -782,6 +793,10 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa, if (req == NULL) return (-ENOMEM); + /* FIXME bug 249. Also see bug 7198 */ + if (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_REQPORTAL) + req->rq_request_portal = OST_IO_PORTAL; + if (opc == OST_WRITE) desc = ptlrpc_prep_bulk_imp (req, page_count, BULK_GET_SOURCE, OST_BULK_PORTAL); @@ -1126,24 +1141,24 @@ static obd_count max_unfragmented_pages(struct brw_page *pg, obd_count pages) int count = 1; int offset; - LASSERT (pages > 0); + LASSERT (pages > 0); offset = pg->off & (PAGE_SIZE - 1); - for (;;) { - pages--; - if (pages == 0) /* that's all */ + for (;;) { + pages--; + if (pages == 0) /* that's all */ return count; if (offset + pg->count < PAGE_SIZE) - return count; /* doesn't end on page boundary */ + return count; /* doesn't end on page boundary */ - pg++; + pg++; offset = pg->off & (PAGE_SIZE - 1); - if (offset != 0) /* doesn't start on page boundary */ - return count; + if (offset != 0) /* doesn't start on page boundary */ + return count; - count++; - } + count++; + } } static int osc_brw(int cmd, struct obd_export *exp, struct obdo *oa, @@ -2026,7 +2041,7 @@ static int osc_queue_async_io(struct obd_export *exp, struct lov_stripe_md *lsm, #ifdef HAVE_QUOTA_SUPPORT if ((cmd & OBD_BRW_WRITE) && !(cmd & OBD_BRW_NOQUOTA)){ struct obd_async_page_ops *ops; - struct obdo *oa = NULL; + struct obdo *oa; oa = obdo_alloc(); if (oa == NULL) @@ -2296,6 +2311,7 @@ static int sanosc_brw_read(struct obd_export *exp, struct obdo *oa, struct niobuf_remote *nioptr; struct obd_ioobj *iooptr; int rc, size[3] = {sizeof(*body)}, mapped = 0; + struct obd_import *imp = class_exp2cliimp(exp); int swab; ENTRY; @@ -2304,11 +2320,15 @@ static int sanosc_brw_read(struct obd_export *exp, struct obdo *oa, size[1] = sizeof(struct obd_ioobj); size[2] = page_count * sizeof(*nioptr); - request = ptlrpc_prep_req(class_exp2cliimp(exp), OST_SAN_READ, 3, - size, NULL); + request = ptlrpc_prep_req(imp, OST_SAN_READ, 3, size, NULL); if (!request) RETURN(-ENOMEM); + /* FIXME bug 249 */ + /* See bug 7198 */ + if (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_REQPORTAL) + request->rq_request_portal = OST_IO_PORTAL; + body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof(*body)); iooptr = lustre_msg_buf(request->rq_reqmsg, 1, sizeof(*iooptr)); nioptr = lustre_msg_buf(request->rq_reqmsg, 2, @@ -2426,6 +2446,7 @@ static int sanosc_brw_write(struct obd_export *exp, struct obdo *oa, struct ost_body *body; struct niobuf_remote *nioptr; struct obd_ioobj *iooptr; + struct obd_import *imp = class_exp2cliimp(exp); int rc, size[3] = {sizeof(*body)}, mapped = 0; int swab; ENTRY; @@ -2433,11 +2454,16 @@ static int sanosc_brw_write(struct obd_export *exp, struct obdo *oa, size[1] = sizeof(struct obd_ioobj); size[2] = page_count * sizeof(*nioptr); - request = ptlrpc_prep_req_pool(class_exp2cliimp(exp), OST_SAN_WRITE, + request = ptlrpc_prep_req_pool(imp, OST_SAN_WRITE, 3, size, NULL, cli->cl_rq_pool); if (!request) RETURN(-ENOMEM); + /* FIXME bug 249 */ + /* See bug 7198 */ + if (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_REQPORTAL) + request->rq_request_portal = OST_IO_PORTAL; + body = lustre_msg_buf(request->rq_reqmsg, 0, sizeof (*body)); iooptr = lustre_msg_buf(request->rq_reqmsg, 1, sizeof (*iooptr)); nioptr = lustre_msg_buf(request->rq_reqmsg, 2, @@ -3121,6 +3147,33 @@ static int osc_llog_finish(struct obd_device *obd, int count) RETURN(rc); } +static int osc_reconnect(struct obd_export *exp, struct obd_device *obd, + struct obd_uuid *cluuid, + struct obd_connect_data *data) +{ + struct client_obd *cli = &obd->u.cli; + + if (data != NULL && (data->ocd_connect_flags & OBD_CONNECT_GRANT)) { + long lost_grant; + + spin_lock(&cli->cl_loi_list_lock); + data->ocd_grant = cli->cl_avail_grant ?: + 2 * cli->cl_max_pages_per_rpc << PAGE_SHIFT; + lost_grant = cli->cl_lost_grant; + cli->cl_lost_grant = 0; + spin_unlock(&cli->cl_loi_list_lock); + + CDEBUG(D_CACHE, "request ocd_grant: %d cl_avail_grant: %ld " + "cl_lost_grant: %ld\n", data->ocd_grant, + cli->cl_avail_grant, lost_grant); + CDEBUG(D_RPCTRACE, "ocd_connect_flags: "LPX64" ocd_version: %d" + " ocd_grant: %d\n", data->ocd_connect_flags, + data->ocd_version, data->ocd_grant); + } + + RETURN(0); +} + static int osc_disconnect(struct obd_export *exp) { struct obd_device *obd = class_exp2obd(exp); @@ -3158,8 +3211,7 @@ static int osc_import_event(struct obd_device *obd, break; } case IMP_EVENT_INACTIVE: { - if (obd->obd_observer) - rc = obd_notify(obd->obd_observer, obd, 0); + rc = obd_notify_observer(obd, obd, OBD_NOTIFY_INACTIVE); break; } case IMP_EVENT_INVALIDATE: { @@ -3187,8 +3239,20 @@ static int osc_import_event(struct obd_device *obd, oscc->oscc_flags &= ~OSCC_FLAG_NOSPC; spin_unlock(&oscc->oscc_lock); } - if (obd->obd_observer) - rc = obd_notify(obd->obd_observer, obd, 1); + rc = obd_notify_observer(obd, obd, OBD_NOTIFY_ACTIVE); + break; + } + case IMP_EVENT_OCD: { + struct obd_connect_data *ocd = &imp->imp_connect_data; + + if (ocd->ocd_connect_flags & OBD_CONNECT_GRANT) + osc_init_grant(&obd->u.cli, ocd); + + /* See bug 7198 */ + if (ocd->ocd_connect_flags & OBD_CONNECT_REQPORTAL) + imp->imp_client->cli_request_portal =OST_REQUEST_PORTAL; + + rc = obd_notify_observer(obd, obd, OBD_NOTIFY_OCD); break; } default: @@ -3238,13 +3302,20 @@ static int osc_precleanup(struct obd_device *obd, int stage) int rc = 0; ENTRY; - if (stage < 2) - RETURN(0); - - rc = obd_llog_finish(obd, 0); - if (rc != 0) - CERROR("failed to cleanup llogging subsystems\n"); - + switch (stage) { + case OBD_CLEANUP_EARLY: { + struct obd_import *imp; + imp = obd->u.cli.cl_import; + CDEBUG(D_HA, "Deactivating import %s\n", obd->obd_name); + /* ptlrpc_abort_inflight to stop an mds_lov_synchronize */ + ptlrpc_deactivate_import(imp); + break; + } + case OBD_CLEANUP_SELF_EXP: + rc = obd_llog_finish(obd, 0); + if (rc != 0) + CERROR("failed to cleanup llogging subsystems\n"); + } RETURN(rc); } @@ -3281,6 +3352,7 @@ struct obd_ops osc_obd_ops = { .o_add_conn = client_import_add_conn, .o_del_conn = client_import_del_conn, .o_connect = client_connect_import, + .o_reconnect = osc_reconnect, .o_disconnect = osc_disconnect, .o_statfs = osc_statfs, .o_packmd = osc_packmd, @@ -3324,6 +3396,7 @@ struct obd_ops sanosc_obd_ops = { .o_add_conn = client_import_add_conn, .o_del_conn = client_import_del_conn, .o_connect = client_connect_import, + .o_reconnect = osc_reconnect, .o_disconnect = client_disconnect_export, .o_statfs = osc_statfs, .o_packmd = osc_packmd, diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index cc54ac0..c016bf9 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -167,18 +167,91 @@ static int ost_create(struct obd_export *exp, struct ptlrpc_request *req, RETURN(0); } +/* + * Helper function for ost_punch(): if asked by client, acquire [size, EOF] + * lock on the file being truncated. + */ +static int ost_punch_lock_get(struct obd_export *exp, struct obdo *oa, + struct lustre_handle *lh) +{ + int flags; + struct ldlm_res_id res_id = { .name = { oa->o_id } }; + ldlm_policy_data_t policy; + __u64 start; + __u64 finis; + + ENTRY; + + LASSERT(!lustre_handle_is_used(lh)); + + if (!(oa->o_valid & OBD_MD_FLFLAGS) || + !(oa->o_flags & OBD_FL_TRUNCLOCK)) + RETURN(0); + + CDEBUG(D_INODE, "OST-side truncate lock.\n"); + + start = oa->o_size; + finis = start + oa->o_blocks; + + /* + * standard truncate optimization: if file body is completely + * destroyed, don't send data back to the server. + */ + flags = (start == 0) ? LDLM_AST_DISCARD_DATA : 0; + + policy.l_extent.start = start & CFS_PAGE_MASK; + + /* + * If ->o_blocks is EOF it means "lock till the end of the + * file". Otherwise, it's size of a hole being punched (in bytes) + */ + if (oa->o_blocks == OBD_OBJECT_EOF || finis < start) + policy.l_extent.end = OBD_OBJECT_EOF; + else + policy.l_extent.end = finis | ~CFS_PAGE_MASK; + + RETURN(ldlm_cli_enqueue(NULL, NULL, exp->exp_obd->obd_namespace, + res_id, LDLM_EXTENT, &policy, LCK_PW, &flags, + ldlm_blocking_ast, ldlm_completion_ast, + ldlm_glimpse_ast, + NULL, NULL, 0, NULL, lh)); +} + +/* + * Helper function for ost_punch(): release lock acquired by + * ost_punch_lock_get(), if any. + */ +static void ost_punch_lock_put(struct obd_export *exp, struct obdo *oa, + struct lustre_handle *lh) +{ + ENTRY; + if (lustre_handle_is_used(lh)) + ldlm_lock_decref(lh, LCK_PW); + EXIT; +} + static int ost_punch(struct obd_export *exp, struct ptlrpc_request *req, struct obd_trans_info *oti) { + struct obdo *oa; struct ost_body *body, *repbody; + struct lustre_handle lh = {0,}; + int rc, size = sizeof(*repbody); + ENTRY; - body = lustre_swab_reqbuf(req, 0, sizeof(*body), lustre_swab_ost_body); + /* + * check that we do support OBD_CONNECT_TRUNCLOCK. + */ + CLASSERT(OST_CONNECT_SUPPORTED & OBD_CONNECT_TRUNCLOCK); + + body = lustre_swab_reqbuf(req, 0, sizeof *body, lustre_swab_ost_body); if (body == NULL) RETURN(-EFAULT); - if ((body->oa.o_valid & (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS)) != + oa = &body->oa; + if ((oa->o_valid & (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS)) != (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS)) RETURN(-EINVAL); @@ -187,10 +260,23 @@ static int ost_punch(struct obd_export *exp, struct ptlrpc_request *req, RETURN(rc); repbody = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*repbody)); - memcpy(&repbody->oa, &body->oa, sizeof(body->oa)); - req->rq_status = obd_punch(exp, &repbody->oa, NULL, repbody->oa.o_size, - repbody->oa.o_blocks, oti); - RETURN(0); + repbody->oa = *oa; + rc = ost_punch_lock_get(exp, oa, &lh); + if (rc == 0) { + if (oa->o_valid & OBD_MD_FLFLAGS && + oa->o_flags == OBD_FL_TRUNCLOCK) + /* + * If OBD_FL_TRUNCLOCK is the only bit set in + * ->o_flags, clear OBD_MD_FLFLAGS to avoid falling + * through filter_setattr() to filter_iocontrol(). + */ + oa->o_valid &= ~OBD_MD_FLFLAGS; + + req->rq_status = obd_punch(exp, oa, NULL, + oa->o_size, oa->o_blocks, oti); + ost_punch_lock_put(exp, oa, &lh); + } + RETURN(rc); } static int ost_sync(struct obd_export *exp, struct ptlrpc_request *req) @@ -461,6 +547,7 @@ static int ost_brw_lock_get(int mode, struct obd_export *exp, ENTRY; LASSERT(mode == LCK_PR || mode == LCK_PW); + LASSERT(!lustre_handle_is_used(lh)); /* EXPENSIVE ASSERTION */ for (i = 1; i < nrbufs; i ++) @@ -487,7 +574,9 @@ static void ost_brw_lock_put(int mode, { ENTRY; LASSERT(mode == LCK_PR || mode == LCK_PW); - if (obj->ioo_bufcnt > 0 && niob[0].flags & OBD_BRW_SRVLOCK) + LASSERT((obj->ioo_bufcnt > 0 && (niob[0].flags & OBD_BRW_SRVLOCK)) == + lustre_handle_is_used(lh)); + if (lustre_handle_is_used(lh)) ldlm_lock_decref(lh, mode); EXIT; } @@ -501,7 +590,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti) struct obd_ioobj *ioo; struct ost_body *body, *repbody; struct l_wait_info lwi; - struct lustre_handle lockh; + struct lustre_handle lockh = {0}; int size[1] = { sizeof(*body) }; int comms_error = 0; int niocount; @@ -707,7 +796,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) struct obd_ioobj *ioo; struct ost_body *body, *repbody; struct l_wait_info lwi; - struct lustre_handle lockh; + struct lustre_handle lockh = {0}; __u32 *rcs; int size[2] = { sizeof(*body) }; int objcount, niocount, npages; @@ -858,7 +947,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) repbody->oa.o_valid |= OBD_MD_FLCKSUM; } else if ((cksum_counter & (-cksum_counter)) == cksum_counter) { - CWARN("Checksum %u from %s: %x OK\n", cksum_counter, + CWARN("Checksum %u from %s: %x OK\n", cksum_counter, libcfs_id2str(req->rq_peer), cksum); } else { cksum_counter++; @@ -1414,7 +1503,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE, OST_MAXREPSIZE, OST_REQUEST_PORTAL, OSC_REPLY_PORTAL, - obd_timeout * 1000, ost_handle, "ost", + obd_timeout * 1000, ost_handle, LUSTRE_OST_NAME, obd->obd_proc_entry, ost_print_req, OST_NUM_THREADS); if (ost->ost_service == NULL) { @@ -1422,9 +1511,6 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) GOTO(out_lprocfs, rc = -ENOMEM); } - ost->ost_service->srv_init = ost_thread_init; - ost->ost_service->srv_done = ost_thread_done; - ost->ost_service->srv_cpu_affinity = 1; rc = ptlrpc_start_threads(obd, ost->ost_service, "ll_ost"); if (rc) GOTO(out_service, rc = -EINVAL); @@ -1445,8 +1531,31 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) if (rc) GOTO(out_create, rc = -EINVAL); + ost->ost_io_service = + ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE, + OST_MAXREPSIZE, OST_IO_PORTAL, + OSC_REPLY_PORTAL, + obd_timeout * 1000, ost_handle, "ost_io", + obd->obd_proc_entry, ost_print_req, + OST_NUM_THREADS); + if (ost->ost_io_service == NULL) { + CERROR("failed to start OST I/O service\n"); + GOTO(out_create, rc = -ENOMEM); + } + + ost->ost_io_service->srv_init = ost_thread_init; + ost->ost_io_service->srv_done = ost_thread_done; + ost->ost_io_service->srv_cpu_affinity = 1; + rc = ptlrpc_start_threads(obd, ost->ost_io_service, + "ll_ost_io"); + if (rc) + GOTO(out_io, rc = -EINVAL); + RETURN(0); +out_io: + ptlrpc_unregister_service(ost->ost_io_service); + ost->ost_io_service = NULL; out_create: ptlrpc_unregister_service(ost->ost_create_service); ost->ost_create_service = NULL; @@ -1474,6 +1583,7 @@ static int ost_cleanup(struct obd_device *obd) down(&ost->ost_health_sem); ptlrpc_unregister_service(ost->ost_service); ptlrpc_unregister_service(ost->ost_create_service); + ptlrpc_unregister_service(ost->ost_io_service); ost->ost_service = NULL; ost->ost_create_service = NULL; up(&ost->ost_health_sem); @@ -1491,6 +1601,7 @@ static int ost_health_check(struct obd_device *obd) down(&ost->ost_health_sem); rc |= ptlrpc_service_health_check(ost->ost_service); rc |= ptlrpc_service_health_check(ost->ost_create_service); + rc |= ptlrpc_service_health_check(ost->ost_io_service); up(&ost->ost_health_sem); /* diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index a2e7dbb..7c63ae6 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "ptlrpc_internal.h" @@ -131,14 +132,13 @@ int ptlrpc_set_import_discon(struct obd_import *imp) "service will %s.\n", target_len, target_start, libcfs_nid2str(imp->imp_connection->c_peer.nid), - imp->imp_replayable - ? "wait for recovery to complete" - : "fail"); + imp->imp_replayable ? + "wait for recovery to complete" : "fail"); if (obd_dump_on_timeout) libcfs_debug_dumplog(); - CWARN("%s: connection lost to %s@%s\n", + CDEBUG(D_HA, "%s: connection lost to %s@%s\n", imp->imp_obd->obd_name, imp->imp_target_uuid.uuid, imp->imp_connection->c_remote_uuid.uuid); @@ -355,6 +355,11 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid) if (rc) GOTO(out, rc); + rc = obd_reconnect(imp->imp_obd->obd_self_export, obd, + &obd->obd_uuid, &imp->imp_connect_data); + if (rc) + GOTO(out, rc); + request = ptlrpc_prep_req(imp, imp->imp_connect_op, 4, size, tmp); if (!request) GOTO(out, rc = -ENOMEM); @@ -369,7 +374,7 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid) request->rq_replen = lustre_msg_size(1, size); request->rq_interpret_reply = ptlrpc_connect_interpret; - LASSERT (sizeof (*aa) <= sizeof (request->rq_async_args)); + CLASSERT(sizeof (*aa) <= sizeof (request->rq_async_args)); aa = (struct ptlrpc_connect_async_args *)&request->rq_async_args; memset(aa, 0, sizeof *aa); @@ -378,7 +383,7 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid) if (aa->pcaa_initial_connect) { imp->imp_replayable = 1; - /* On an initial connect, we don't know which one of a + /* On an initial connect, we don't know which one of a failover server pair is up. Don't wait long. */ request->rq_timeout = max((int)(obd_timeout / 20), 5); } @@ -558,6 +563,29 @@ finish: imp->imp_connect_data.ocd_connect_flags) == ocd->ocd_connect_flags); imp->imp_connect_data = *ocd; + obd_import_event(imp->imp_obd, imp, IMP_EVENT_OCD); + + if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && + (ocd->ocd_version > LUSTRE_VERSION_CODE + + LUSTRE_VERSION_OFFSET_WARN)) { + /* Sigh, some compilers do not like #ifdef in the middle + of macro arguments */ +#ifdef __KERNEL__ + char *action = "upgrading this client"; +#else + char *action = "recompiling this application"; +#endif + + CWARN("Server %s version (%d.%d.%d.%d) is much newer. " + "Consider %s (%s).\n", + imp->imp_target_uuid.uuid, + OBD_OCD_VERSION_MAJOR(ocd->ocd_version), + OBD_OCD_VERSION_MINOR(ocd->ocd_version), + OBD_OCD_VERSION_PATCH(ocd->ocd_version), + OBD_OCD_VERSION_FIX(ocd->ocd_version), + action, LUSTRE_VERSION_STRING); + } + if (imp->imp_conn_current != NULL) { list_del(&imp->imp_conn_current->oic_item); list_add(&imp->imp_conn_current->oic_item, @@ -576,11 +604,38 @@ finish: out: if (rc != 0) { + IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); if (aa->pcaa_initial_connect && !imp->imp_initial_recov) { ptlrpc_deactivate_import(imp); } + if (rc == -EPROTO) { + struct obd_connect_data *ocd; + ocd = lustre_swab_repbuf(request, 0, + sizeof *ocd, + lustre_swab_connect); + if (ocd && + (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && + (ocd->ocd_version != LUSTRE_VERSION_CODE)) { + /* Actually servers are only supposed to refuse + connection from liblustre clients, so we should + never see this from VFS context */ + CERROR("Server %s version (%d.%d.%d.%d) refused" + " connection from this client as too old " + "version (%s). Client must be " + "recompiled\n", + imp->imp_target_uuid.uuid, + OBD_OCD_VERSION_MAJOR(ocd->ocd_version), + OBD_OCD_VERSION_MINOR(ocd->ocd_version), + OBD_OCD_VERSION_PATCH(ocd->ocd_version), + OBD_OCD_VERSION_FIX(ocd->ocd_version), + LUSTRE_VERSION_STRING); + IMPORT_SET_STATE(imp, LUSTRE_IMP_CLOSED); + RETURN(-EPROTO); + } + } + ptlrpc_maybe_ping_import_soon(imp); CDEBUG(D_HA, "recovery of %s on %s failed (%d)\n", diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index d2a410e..85d2c01 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -82,12 +82,6 @@ struct ll_rpc_opcode { { LDLM_BL_CALLBACK, "ldlm_bl_callback" }, { LDLM_CP_CALLBACK, "ldlm_cp_callback" }, { LDLM_GL_CALLBACK, "ldlm_gl_callback" }, - { PTLBD_QUERY, "ptlbd_query" }, - { PTLBD_READ, "ptlbd_read" }, - { PTLBD_WRITE, "ptlbd_write" }, - { PTLBD_FLUSH, "ptlbd_flush" }, - { PTLBD_CONNECT, "ptlbd_connect" }, - { PTLBD_DISCONNECT, "ptlbd_disconnect" }, { OBD_PING, "obd_ping" }, { OBD_LOG_CANCEL, "llog_origin_handle_cancel"}, }; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index ec2dca7..d886424 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -441,6 +441,16 @@ void *lustre_swab_repbuf(struct ptlrpc_request *req, int index, int min_size, void lustre_swab_connect(struct obd_connect_data *ocd) { __swab64s (&ocd->ocd_connect_flags); + __swab32s (&ocd->ocd_version); + __swab32s (&ocd->ocd_grant); + __swab32s (&ocd->ocd_index); + __swab32s (&ocd->ocd_unused); + CLASSERT(offsetof(typeof(*ocd), padding1) != 0); + CLASSERT(offsetof(typeof(*ocd), padding2) != 0); + CLASSERT(offsetof(typeof(*ocd), padding3) != 0); + CLASSERT(offsetof(typeof(*ocd), padding4) != 0); + CLASSERT(offsetof(typeof(*ocd), padding5) != 0); + CLASSERT(offsetof(typeof(*ocd), padding6) != 0); } void lustre_swab_obdo (struct obdo *o) @@ -465,8 +475,8 @@ void lustre_swab_obdo (struct obdo *o) __swab32s (&o->o_misc); __swab32s (&o->o_easize); __swab32s (&o->o_mds); - __swab32s (&o->o_padding_1); - __swab32s (&o->o_padding_2); + CLASSERT(offsetof(typeof(*o), o_padding_1) != 0); + CLASSERT(offsetof(typeof(*o), o_padding_2) != 0); /* o_inline is opaque */ } @@ -478,11 +488,11 @@ void lustre_swab_obd_statfs (struct obd_statfs *os) __swab64s (&os->os_bavail); __swab64s (&os->os_files); __swab64s (&os->os_ffree); - /* no need to swap os_fsid */ + /* no need to swab os_fsid */ __swab32s (&os->os_bsize); __swab32s (&os->os_namelen); __swab64s (&os->os_maxbytes); - /* no need to swap os_spare */ + CLASSERT(offsetof(typeof(*os), os_spare) != 0); } void lustre_swab_obd_ioobj (struct obd_ioobj *ioo) @@ -550,10 +560,10 @@ void lustre_swab_mds_body (struct mds_body *b) __swab32s (&b->generation); __swab32s (&b->suppgid); __swab32s (&b->eadatasize); - __swab32s (&b->padding_1); - __swab32s (&b->padding_2); - __swab32s (&b->padding_3); - __swab32s (&b->padding_4); + CLASSERT(offsetof(typeof(*b), padding_1) != 0); + CLASSERT(offsetof(typeof(*b), padding_2) != 0); + CLASSERT(offsetof(typeof(*b), padding_3) != 0); + CLASSERT(offsetof(typeof(*b), padding_4) != 0); } void lustre_swab_mgmt_ost_info(struct mgmt_ost_info *oinfo) @@ -590,7 +600,7 @@ static void lustre_swab_obd_dqblk (struct obd_dqblk *b) __swab64s (&b->dqb_btime); __swab64s (&b->dqb_itime); __swab32s (&b->dqb_valid); - __swab32s (&b->padding); + CLASSERT(offsetof(typeof(*b), padding) != 0); } void lustre_swab_obd_quotactl (struct obd_quotactl *q) @@ -620,7 +630,7 @@ void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa) __swab32s (&sa->sa_uid); __swab32s (&sa->sa_gid); __swab32s (&sa->sa_attr_flags); - __swab32s (&sa->sa_padding); + CLASSERT(offsetof(typeof(*sa), sa_padding) != 0); } void lustre_swab_mds_rec_create (struct mds_rec_create *cr) @@ -636,11 +646,11 @@ void lustre_swab_mds_rec_create (struct mds_rec_create *cr) __swab64s (&cr->cr_time); __swab64s (&cr->cr_rdev); __swab32s (&cr->cr_suppgid); - __swab32s (&cr->cr_padding_1); - __swab32s (&cr->cr_padding_2); - __swab32s (&cr->cr_padding_3); - __swab32s (&cr->cr_padding_4); - __swab32s (&cr->cr_padding_5); + CLASSERT(offsetof(typeof(*cr), cr_padding_1) != 0); + CLASSERT(offsetof(typeof(*cr), cr_padding_2) != 0); + CLASSERT(offsetof(typeof(*cr), cr_padding_3) != 0); + CLASSERT(offsetof(typeof(*cr), cr_padding_4) != 0); + CLASSERT(offsetof(typeof(*cr), cr_padding_5) != 0); } void lustre_swab_mds_rec_link (struct mds_rec_link *lk) @@ -654,10 +664,10 @@ void lustre_swab_mds_rec_link (struct mds_rec_link *lk) lustre_swab_ll_fid (&lk->lk_fid1); lustre_swab_ll_fid (&lk->lk_fid2); __swab64s (&lk->lk_time); - __swab32s (&lk->lk_padding_1); - __swab32s (&lk->lk_padding_2); - __swab32s (&lk->lk_padding_3); - __swab32s (&lk->lk_padding_4); + CLASSERT(offsetof(typeof(*lk), lk_padding_1) != 0); + CLASSERT(offsetof(typeof(*lk), lk_padding_2) != 0); + CLASSERT(offsetof(typeof(*lk), lk_padding_3) != 0); + CLASSERT(offsetof(typeof(*lk), lk_padding_4) != 0); } void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul) @@ -671,10 +681,10 @@ void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul) lustre_swab_ll_fid (&ul->ul_fid1); lustre_swab_ll_fid (&ul->ul_fid2); __swab64s (&ul->ul_time); - __swab32s (&ul->ul_padding_1); - __swab32s (&ul->ul_padding_2); - __swab32s (&ul->ul_padding_3); - __swab32s (&ul->ul_padding_4); + CLASSERT(offsetof(typeof(*ul), ul_padding_1) != 0); + CLASSERT(offsetof(typeof(*ul), ul_padding_2) != 0); + CLASSERT(offsetof(typeof(*ul), ul_padding_3) != 0); + CLASSERT(offsetof(typeof(*ul), ul_padding_4) != 0); } void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn) @@ -688,10 +698,10 @@ void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn) lustre_swab_ll_fid (&rn->rn_fid1); lustre_swab_ll_fid (&rn->rn_fid2); __swab64s (&rn->rn_time); - __swab32s (&rn->rn_padding_1); - __swab32s (&rn->rn_padding_2); - __swab32s (&rn->rn_padding_3); - __swab32s (&rn->rn_padding_4); + CLASSERT(offsetof(typeof(*rn), rn_padding_1) != 0); + CLASSERT(offsetof(typeof(*rn), rn_padding_2) != 0); + CLASSERT(offsetof(typeof(*rn), rn_padding_3) != 0); + CLASSERT(offsetof(typeof(*rn), rn_padding_4) != 0); } void lustre_swab_lov_desc (struct lov_desc *ld) @@ -793,6 +803,7 @@ void lustre_swab_ldlm_intent (struct ldlm_intent *i) void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r) { __swab32s (&r->lr_type); + CLASSERT(offsetof(typeof(*r), lr_padding) != 0); lustre_swab_ldlm_res_id (&r->lr_name); } @@ -807,6 +818,7 @@ void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l) void lustre_swab_ldlm_request (struct ldlm_request *rq) { __swab32s (&rq->lock_flags); + CLASSERT(offsetof(typeof(*rq), lock_padding) != 0); lustre_swab_ldlm_lock_desc (&rq->lock_desc); /* lock_handle1 opaque */ /* lock_handle2 opaque */ @@ -815,35 +827,13 @@ void lustre_swab_ldlm_request (struct ldlm_request *rq) void lustre_swab_ldlm_reply (struct ldlm_reply *r) { __swab32s (&r->lock_flags); + CLASSERT(offsetof(typeof(*r), lock_padding) != 0); lustre_swab_ldlm_lock_desc (&r->lock_desc); /* lock_handle opaque */ __swab64s (&r->lock_policy_res1); __swab64s (&r->lock_policy_res2); } -void lustre_swab_ptlbd_op (struct ptlbd_op *op) -{ - __swab16s (&op->op_cmd); - __swab16s (&op->op_lun); - __swab16s (&op->op_niob_cnt); - /* ignore op__padding */ - __swab32s (&op->op_block_cnt); -} - -void lustre_swab_ptlbd_niob (struct ptlbd_niob *n) -{ - __swab64s (&n->n_xid); - __swab64s (&n->n_block_nr); - __swab32s (&n->n_offset); - __swab32s (&n->n_length); -} - -void lustre_swab_ptlbd_rsp (struct ptlbd_rsp *r) -{ - __swab16s (&r->r_status); - __swab16s (&r->r_error_cnt); -} - /* no one calls this */ int llog_log_swabbed(struct llog_log_hdr *hdr) { @@ -865,8 +855,8 @@ void lustre_swab_qdata(struct qunit_data *d) void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' - * running on Linux mustang 2.6.12-1.1456_FC4smp #1 SMP Thu Sep 22 02:22:14 EDT 2005 i686 i68 - * with gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) */ + * running on Linux schatzie.adilger.int 2.6.12-1.1378_FC3 #1 Wed Sep 14 04:24:31 EDT 2005 i6 + * with gcc version 3.3.4 20040817 (Red Hat Linux 3.3.4-2) */ /* Constants... */ @@ -1010,6 +1000,8 @@ void lustre_assert_wire_constants(void) (long long)LDLM_BL_CALLBACK); LASSERTF(LDLM_CP_CALLBACK == 105, " found %lld\n", (long long)LDLM_CP_CALLBACK); + LASSERTF(LDLM_GL_CALLBACK == 106, " found %lld\n", + (long long)LDLM_GL_CALLBACK); LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n", (long long)LDLM_LAST_OPC); LASSERTF(LCK_EX == 1, " found %lld\n", @@ -1024,20 +1016,10 @@ void lustre_assert_wire_constants(void) (long long)LCK_CR); LASSERTF(LCK_NL == 32, " found %lld\n", (long long)LCK_NL); - LASSERTF(PTLBD_QUERY == 200, " found %lld\n", - (long long)PTLBD_QUERY); - LASSERTF(PTLBD_READ == 201, " found %lld\n", - (long long)PTLBD_READ); - LASSERTF(PTLBD_WRITE == 202, " found %lld\n", - (long long)PTLBD_WRITE); - LASSERTF(PTLBD_FLUSH == 203, " found %lld\n", - (long long)PTLBD_FLUSH); - LASSERTF(PTLBD_CONNECT == 204, " found %lld\n", - (long long)PTLBD_CONNECT); - LASSERTF(PTLBD_DISCONNECT == 205, " found %lld\n", - (long long)PTLBD_DISCONNECT); - LASSERTF(PTLBD_LAST_OPC == 206, " found %lld\n", - (long long)PTLBD_LAST_OPC); + LASSERTF(LCK_GROUP == 64, " found %lld\n", + (long long)LCK_GROUP); + LASSERTF(LCK_MAXMODE == 65, " found %lld\n", + (long long)LCK_MAXMODE); LASSERTF(MGMT_CONNECT == 250, " found %lld\n", (long long)MGMT_CONNECT); LASSERTF(MGMT_DISCONNECT == 251, " found %lld\n", @@ -1062,6 +1044,20 @@ void lustre_assert_wire_constants(void) (long long)QUOTA_DQACQ); LASSERTF(QUOTA_DQREL == 602, " found %lld\n", (long long)QUOTA_DQREL); + LASSERTF(OBD_CONNECT_RDONLY == 1, " found %lld\n", + (long long)OBD_CONNECT_RDONLY); + LASSERTF(OBD_CONNECT_INDEX == 2, " found %lld\n", + (long long)OBD_CONNECT_INDEX); + LASSERTF(OBD_CONNECT_GRANT == 8, " found %lld\n", + (long long)OBD_CONNECT_GRANT); + LASSERTF(OBD_CONNECT_SRVLOCK == 16, " found %lld\n", + (long long)OBD_CONNECT_SRVLOCK); + LASSERTF(OBD_CONNECT_ACL == 128, " found %lld\n", + (long long)OBD_CONNECT_ACL); + LASSERTF(OBD_CONNECT_XATTR == 256, " found %lld\n", + (long long)OBD_CONNECT_XATTR); + LASSERTF(OBD_CONNECT_CROW == 512, " found %lld\n", + (long long)OBD_CONNECT_CROW); /* Sizes and Offsets */ @@ -1208,6 +1204,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_mds)); LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_mds)); + LASSERTF((int)offsetof(struct obdo, o_padding_1) == 120, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_padding_1)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_padding_1)); + LASSERTF((int)offsetof(struct obdo, o_padding_2) == 124, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_padding_2)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_padding_2)); LASSERTF((int)offsetof(struct obdo, o_inline) == 128, " found %lld\n", (long long)(int)offsetof(struct obdo, o_inline)); LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 80, " found %lld\n", @@ -1500,6 +1504,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_dqblk, dqb_valid)); LASSERTF((int)sizeof(((struct obd_dqblk *)0)->dqb_valid) == 4, " found %lld\n", (long long)(int)sizeof(((struct obd_dqblk *)0)->dqb_valid)); + LASSERTF((int)offsetof(struct obd_dqblk, padding) == 68, " found %lld\n", + (long long)(int)offsetof(struct obd_dqblk, padding)); + LASSERTF((int)sizeof(((struct obd_dqblk *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_dqblk *)0)->padding)); /* Checks for struct niobuf_remote */ LASSERTF((int)sizeof(struct niobuf_remote) == 16, " found %lld\n", @@ -1658,6 +1666,22 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct mds_body, eadatasize)); LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n", (long long)(int)sizeof(((struct mds_body *)0)->eadatasize)); + LASSERTF((int)offsetof(struct mds_body, padding_1) == 152, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_1)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_1)); + LASSERTF((int)offsetof(struct mds_body, padding_2) == 156, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_2)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_2)); + LASSERTF((int)offsetof(struct mds_body, padding_3) == 160, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_3)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_3)); + LASSERTF((int)offsetof(struct mds_body, padding_4) == 164, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_4)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_4) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_4)); LASSERTF(FMODE_READ == 1, " found %lld\n", (long long)FMODE_READ); LASSERTF(FMODE_WRITE == 2, " found %lld\n", @@ -1940,6 +1964,26 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_desc, ld_default_stripe_offset)); LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n", (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset)); + LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_offset) == 24, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_default_stripe_offset)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_1) == 32, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_1)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_1)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_2) == 36, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_2)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_2)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_3) == 40, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_3)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_3)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_4) == 44, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_4)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_4) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_4)); LASSERTF((int)offsetof(struct lov_desc, ld_uuid) == 48, " found %lld\n", (long long)(int)offsetof(struct lov_desc, ld_uuid)); LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, " found %lld\n", @@ -2004,6 +2048,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ldlm_resource_desc, lr_type)); LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4, " found %lld\n", (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_type)); + LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_padding) == 4, " found %lld\n", + (long long)(int)offsetof(struct ldlm_resource_desc, lr_padding)); + LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_padding)); LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_name) == 8, " found %lld\n", (long long)(int)offsetof(struct ldlm_resource_desc, lr_name)); LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32, " found %lld\n", @@ -2036,6 +2084,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ldlm_request, lock_flags)); LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4, " found %lld\n", (long long)(int)sizeof(((struct ldlm_request *)0)->lock_flags)); + LASSERTF((int)offsetof(struct ldlm_request, lock_padding) == 4, " found %lld\n", + (long long)(int)offsetof(struct ldlm_request, lock_padding)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_padding)); LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", (long long)(int)offsetof(struct ldlm_request, lock_desc)); LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", @@ -2056,6 +2108,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ldlm_reply, lock_flags)); LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4, " found %lld\n", (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_flags)); + LASSERTF((int)offsetof(struct ldlm_request, lock_padding) == 4, " found %lld\n", + (long long)(int)offsetof(struct ldlm_request, lock_padding)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_padding)); LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", (long long)(int)offsetof(struct ldlm_request, lock_desc)); LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", @@ -2097,62 +2153,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n", (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks)); - /* Checks for struct ptlbd_op */ - LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n", - (long long)(int)sizeof(struct ptlbd_op)); - LASSERTF((int)offsetof(struct ptlbd_op, op_cmd) == 0, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_cmd)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_cmd)); - LASSERTF((int)offsetof(struct ptlbd_op, op_lun) == 2, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_lun)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_lun)); - LASSERTF((int)offsetof(struct ptlbd_op, op_niob_cnt) == 4, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_niob_cnt)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt)); - LASSERTF((int)offsetof(struct ptlbd_op, op__padding) == 6, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op__padding)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op__padding)); - LASSERTF((int)offsetof(struct ptlbd_op, op_block_cnt) == 8, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_block_cnt)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_block_cnt)); - - /* Checks for struct ptlbd_niob */ - LASSERTF((int)sizeof(struct ptlbd_niob) == 24, " found %lld\n", - (long long)(int)sizeof(struct ptlbd_niob)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_xid) == 0, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_xid)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_xid)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_block_nr) == 8, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_block_nr)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_block_nr)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_offset) == 16, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_offset)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_offset)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_length) == 20, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_length)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_length)); - - /* Checks for struct ptlbd_rsp */ - LASSERTF((int)sizeof(struct ptlbd_rsp) == 4, " found %lld\n", - (long long)(int)sizeof(struct ptlbd_rsp)); - LASSERTF((int)offsetof(struct ptlbd_rsp, r_status) == 0, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_rsp, r_status)); - LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_status)); - LASSERTF((int)offsetof(struct ptlbd_rsp, r_error_cnt) == 2, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_rsp, r_error_cnt)); - LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt)); - /* Checks for struct llog_logid */ LASSERTF((int)sizeof(struct llog_logid) == 20, " found %lld\n", (long long)(int)sizeof(struct llog_logid)); @@ -2178,6 +2178,8 @@ void lustre_assert_wire_constants(void) (long long)MDS_SETATTR_REC); LASSERTF(OBD_CFG_REC == 274857984, " found %lld\n", (long long)OBD_CFG_REC); + LASSERTF(PTL_CFG_REC == 274923520, " found %lld\n", + (long long)PTL_CFG_REC); LASSERTF(LLOG_GEN_REC == 274989056, " found %lld\n", (long long)LLOG_GEN_REC); LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n", @@ -2192,6 +2194,18 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_catid, lci_logid)); LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n", (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid)); + LASSERTF((int)offsetof(struct llog_catid, lci_padding1) == 20, " found %lld\n", + (long long)(int)offsetof(struct llog_catid, lci_padding1)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_padding1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_padding1)); + LASSERTF((int)offsetof(struct llog_catid, lci_padding2) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_catid, lci_padding2)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_padding2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_padding2)); + LASSERTF((int)offsetof(struct llog_catid, lci_padding3) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_catid, lci_padding3)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_padding3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_padding3)); /* Checks for struct llog_rec_hdr */ LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n", @@ -2208,6 +2222,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_rec_hdr, lrh_type)); LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type)); + LASSERTF((int)offsetof(struct llog_rec_hdr, padding) == 12, " found %lld\n", + (long long)(int)offsetof(struct llog_rec_hdr, padding)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->padding)); /* Checks for struct llog_rec_tail */ LASSERTF((int)sizeof(struct llog_rec_tail) == 8, " found %lld\n", @@ -2232,6 +2250,26 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_logid_rec, lid_id)); LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n", (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding1) == 36, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding1)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding1)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding2) == 40, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding2)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding2)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding3) == 44, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding3)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding3)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding4) == 48, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding4)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding4) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding4)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding5) == 52, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding5)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding5) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding5)); LASSERTF((int)offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n", (long long)(int)offsetof(struct llog_logid_rec, lid_tail)); LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n", @@ -2256,6 +2294,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_create_rec, lcr_ogen)); LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen)); + LASSERTF((int)offsetof(struct llog_create_rec, padding) == 44, " found %lld\n", + (long long)(int)offsetof(struct llog_create_rec, padding)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->padding)); /* Checks for struct llog_orphan_rec */ LASSERTF((int)sizeof(struct llog_orphan_rec) == 40, " found %lld\n", @@ -2272,6 +2314,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_orphan_rec, lor_ogen)); LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen)); + LASSERTF((int)offsetof(struct llog_orphan_rec, padding) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_orphan_rec, padding)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->padding)); LASSERTF((int)offsetof(struct llog_orphan_rec, lor_tail) == 32, " found %lld\n", (long long)(int)offsetof(struct llog_orphan_rec, lor_tail)); LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8, " found %lld\n", @@ -2292,11 +2338,47 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_unlink_rec, lur_ogen)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen)); + LASSERTF((int)offsetof(struct llog_unlink_rec, padding) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_unlink_rec, padding)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->padding)); LASSERTF((int)offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n", (long long)(int)offsetof(struct llog_unlink_rec, lur_tail)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_tail)); + /* Checks for struct llog_setattr_rec */ + LASSERTF((int)sizeof(struct llog_setattr_rec) == 48, " found %lld\n", + (long long)(int)sizeof(struct llog_setattr_rec)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_hdr) == 0, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_hdr)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_hdr)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_oid) == 16, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_oid)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_ogen) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_ogen)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_uid) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_uid)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_uid)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_gid) == 32, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_gid)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_gid)); + LASSERTF((int)offsetof(struct llog_setattr_rec, padding) == 36, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, padding)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->padding)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_tail) == 40, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_tail)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_tail)); + /* Checks for struct llog_size_change_rec */ LASSERTF((int)sizeof(struct llog_size_change_rec) == 48, " found %lld\n", (long long)(int)sizeof(struct llog_size_change_rec)); @@ -2312,6 +2394,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_size_change_rec, lsc_io_epoch)); LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch)); + LASSERTF((int)offsetof(struct llog_size_change_rec, padding) == 36, " found %lld\n", + (long long)(int)offsetof(struct llog_size_change_rec, padding)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->padding)); LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_tail) == 40, " found %lld\n", (long long)(int)offsetof(struct llog_size_change_rec, lsc_tail)); LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8, " found %lld\n", @@ -2408,6 +2494,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_cookie, lgc_index)); LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index)); + LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_cookie, lgc_padding)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding)); /* Checks for struct llogd_body */ LASSERTF((int)sizeof(struct llogd_body) == 48, " found %lld\n", diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index 364fbca..0ce3872 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -75,16 +75,9 @@ static inline int opcode_offset(__u32 opc) { return (opc - LDLM_FIRST_OPC + (MDS_LAST_OPC - MDS_FIRST_OPC) + (OST_LAST_OPC - OST_FIRST_OPC)); - } else if (opc < PTLBD_LAST_OPC) { - /* Portals Block Device */ - return (opc - PTLBD_FIRST_OPC + - (LDLM_LAST_OPC - LDLM_FIRST_OPC) + - (MDS_LAST_OPC - MDS_FIRST_OPC) + - (OST_LAST_OPC - OST_FIRST_OPC)); } else if (opc < OBD_LAST_OPC) { /* OBD Ping */ return (opc - OBD_FIRST_OPC + - (PTLBD_LAST_OPC - PTLBD_FIRST_OPC) + (LDLM_LAST_OPC - LDLM_FIRST_OPC) + (MDS_LAST_OPC - MDS_FIRST_OPC) + (OST_LAST_OPC - OST_FIRST_OPC)); @@ -94,8 +87,7 @@ static inline int opcode_offset(__u32 opc) { } } -#define LUSTRE_MAX_OPCODES ((PTLBD_LAST_OPC - PTLBD_FIRST_OPC) + \ - (LDLM_LAST_OPC - LDLM_FIRST_OPC) + \ +#define LUSTRE_MAX_OPCODES ((LDLM_LAST_OPC - LDLM_FIRST_OPC) + \ (MDS_LAST_OPC - MDS_FIRST_OPC) + \ (OST_LAST_OPC - OST_FIRST_OPC) + \ (OBD_LAST_OPC - OBD_FIRST_OPC)) diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index ff1c66f..55651fb 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -182,9 +182,6 @@ EXPORT_SYMBOL(lustre_swab_ldlm_resource_desc); EXPORT_SYMBOL(lustre_swab_ldlm_lock_desc); EXPORT_SYMBOL(lustre_swab_ldlm_request); EXPORT_SYMBOL(lustre_swab_ldlm_reply); -EXPORT_SYMBOL(lustre_swab_ptlbd_op); -EXPORT_SYMBOL(lustre_swab_ptlbd_niob); -EXPORT_SYMBOL(lustre_swab_ptlbd_rsp); EXPORT_SYMBOL(lustre_swab_qdata); EXPORT_SYMBOL(lustre_swab_mgmt_ost_info); EXPORT_SYMBOL(lustre_swab_mgmt_mds_info); diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 7157cc2..c7db61a 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -746,4 +746,15 @@ test_18() { } run_test 18 "check lconf creates large journals" +test_19() { + # first format the ost/mdt + start_ost + start_mds + stop_mds + stop_ost + start mds $MDSLCONFARGS || return 1 + stop mds --force || return 2 +} +run_test 19 "start/stop MDS without OSTs" + equals_msg "Done" diff --git a/lustre/tests/insanity.sh b/lustre/tests/insanity.sh index c6d0a1b..4e89693 100755 --- a/lustre/tests/insanity.sh +++ b/lustre/tests/insanity.sh @@ -152,7 +152,7 @@ cleanup() { stop mds ${FORCE} $MDSLCONFARGS || : for i in `seq $NUMOST`; do - stop ost$i ${REFORMAT} ${FORCE} $OSTLCONFARGS || : + stop ost$i ${FORCE} $OSTLCONFARGS || : done } diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index a73931b..5633a57 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -47,9 +47,7 @@ llog_reader_LDADD := $(LIBREADLINE) $(LIBPTLCTL) llog_reader_DEPENDENCIES := $(LIBPTLCTL) llog_reader_SOURCES = llog_reader.c -# FIXME whats this GM stuff for?? -mount_lustre_CFLAGS = $(LLMOUNT_GM_CFLAGS) -mount_lustre_LDADD := $(LIBREADLINE) $(LIBPTLCTL) $(LLMOUNT_GM_LDADD) +mount_lustre_LDADD := $(LIBREADLINE) $(LIBPTLCTL) mount_lustre_DEPENDENCIES := $(LIBPTLCTL) mount_lustre_SOURCES = mount_lustre.c diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 05f1518..4cca6ba 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -1319,7 +1319,7 @@ class MDSDEV(Module): Module.cleanup(self) clean_loop(self.devpath) - #change the mtime of CONFIGS to match the XML creation time + #change the mtime of LLOG to match the XML creation time if toplustreDB.get_mtime(): mtime = string.atof(toplustreDB.get_mtime()) runcmd("mkdir /tmp/lustre-XXXX/") @@ -1329,9 +1329,8 @@ class MDSDEV(Module): ret, out = runcmd("mount -o loop %s /tmp/lustre-XXXX/" %self.devpath) if ret: print out[0] - try: - # MOUNT_CONFIGS_DIR + # MOUNT_CONFIGS_DIR os.utime("/tmp/lustre-XXXX/CONFIGS", (mtime, mtime)) except OSError: runcmd("umount -f /tmp/lustre-XXXX/") diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index ae1332c..6375e15 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -787,7 +787,7 @@ static inline char *type2name(int check_type) static void grace2str(time_t seconds,char *buf) { uint minutes, hours, days; - + minutes = (seconds + 30) / 60; hours = minutes / 60; minutes %= 60; diff --git a/lustre/utils/llog_reader.c b/lustre/utils/llog_reader.c index bb53091..4ea9996 100644 --- a/lustre/utils/llog_reader.c +++ b/lustre/utils/llog_reader.c @@ -213,12 +213,16 @@ void print_llog_header(struct llog_log_hdr* llog_buf) static void print_1_cfg(struct lustre_cfg *lcfg) { int i; + if (lcfg->lcfg_nid) + printf("nid=%s("LPX64") ", libcfs_nid2str(lcfg->lcfg_nid), + lcfg->lcfg_nid); for (i = 0; i < lcfg->lcfg_bufcount; i++) printf("%d:%.*s ", i, lcfg->lcfg_buflens[i], (char*)lustre_cfg_buf(lcfg, i)); return; } + static void print_setup_cfg(struct lustre_cfg *lcfg) { struct lov_desc *desc; @@ -226,16 +230,16 @@ static void print_setup_cfg(struct lustre_cfg *lcfg) if ((lcfg->lcfg_bufcount == 2) && (lcfg->lcfg_buflens[1] == sizeof(*desc))) { printf("lov_setup "); - printf("0:%s ", lustre_cfg_string(lcfg, 0)); + printf("0:%s ", lustre_cfg_string(lcfg, 0)); printf("1:(struct lov_desc)\n"); desc = (struct lov_desc*)(lustre_cfg_string(lcfg, 1)); - printf(" uuid=%s, ", (char*)desc->ld_uuid.uuid); - printf("stripe count=%d, ", desc->ld_default_stripe_count); - printf("size=%lld, ", desc->ld_default_stripe_size); - printf("offset=%lld, ", desc->ld_default_stripe_offset); + printf("\t\tuuid=%s ", (char*)desc->ld_uuid.uuid); + printf("stripe:cnt=%d ", desc->ld_default_stripe_count); + printf("size=%lld ", desc->ld_default_stripe_size); + printf("offset=%lld ", desc->ld_default_stripe_offset); printf("pattern=%d", desc->ld_pattern); } else { - printf("setup "); + printf("setup "); print_1_cfg(lcfg); } return; @@ -247,7 +251,7 @@ void print_lustre_cfg(struct lustre_cfg *lcfg) switch(cmd){ case(LCFG_ATTACH):{ - printf("attach "); + printf("attach "); print_1_cfg(lcfg); break; } @@ -256,37 +260,32 @@ void print_lustre_cfg(struct lustre_cfg *lcfg) break; } case(LCFG_DETACH):{ - printf("detach "); + printf("detach "); print_1_cfg(lcfg); break; } case(LCFG_CLEANUP):{ - printf("cleanup "); + printf("cleanup "); print_1_cfg(lcfg); break; } case(LCFG_ADD_UUID):{ - printf("add_uuid "); - printf("nid=%s("LPX64") ", - libcfs_nid2str(lcfg->lcfg_nid), lcfg->lcfg_nid); - /* obsolete */ - if (lcfg->lcfg_nal) - printf("nal=%d ", lcfg->lcfg_nal); + printf("add_uuid "); print_1_cfg(lcfg); break; } case(LCFG_DEL_UUID):{ - printf("del_uuid "); + printf("del_uuid "); print_1_cfg(lcfg); break; } case(LCFG_ADD_CONN):{ - printf("add_conn "); + printf("add_conn "); print_1_cfg(lcfg); break; } case(LCFG_DEL_CONN):{ - printf("del_conn "); + printf("del_conn "); print_1_cfg(lcfg); break; } @@ -320,6 +319,16 @@ void print_lustre_cfg(struct lustre_cfg *lcfg) print_1_cfg(lcfg); break; } + case(LCFG_PARAM):{ + printf("param "); + print_1_cfg(lcfg); + break; + } + case(LCFG_MARKER):{ + printf("marker "); + print_1_cfg(lcfg); + break; + } default: printf("unsupported cmd_code = %x\n",cmd); } diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 800196e..b548e98 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -64,16 +64,7 @@ do { \ } while(0) - -void check1(void) -{ -#define VALUE 1234567 - - CHECK_VALUE(VALUE); - CHECK_DEFINE(VALUE); -} - -void +static void check_lustre_handle(void) { BLANK_LINE(); @@ -81,7 +72,7 @@ check_lustre_handle(void) CHECK_MEMBER(lustre_handle, cookie); } -void +static void check_lustre_msg(void) { BLANK_LINE(); @@ -100,7 +91,7 @@ check_lustre_msg(void) CHECK_MEMBER(lustre_msg, buflens[7]); } -void +static void check_obdo(void) { BLANK_LINE(); @@ -125,6 +116,8 @@ check_obdo(void) CHECK_MEMBER(obdo, o_misc); CHECK_MEMBER(obdo, o_easize); CHECK_MEMBER(obdo, o_mds); + CHECK_MEMBER(obdo, o_padding_1); + CHECK_MEMBER(obdo, o_padding_2); CHECK_MEMBER(obdo, o_inline); CHECK_VALUE(OBD_INLINESZ); @@ -172,7 +165,7 @@ check_obdo(void) CHECK_VALUE(OBD_FL_NO_GRPQUOTA); } -void +static void check_lov_mds_md_v1(void) { BLANK_LINE(); @@ -198,7 +191,7 @@ check_lov_mds_md_v1(void) CHECK_VALUE(LOV_PATTERN_RAID1); } -void +static void check_obd_statfs(void) { BLANK_LINE(); @@ -214,7 +207,7 @@ check_obd_statfs(void) CHECK_MEMBER(obd_statfs, os_spare); } -void +static void check_obd_ioobj(void) { BLANK_LINE(); @@ -225,7 +218,7 @@ check_obd_ioobj(void) CHECK_MEMBER(obd_ioobj, ioo_bufcnt); } -void +static void check_obd_quotactl(void) { BLANK_LINE(); @@ -255,9 +248,10 @@ check_obd_quotactl(void) CHECK_MEMBER(obd_dqblk, dqb_btime); CHECK_MEMBER(obd_dqblk, dqb_itime); CHECK_MEMBER(obd_dqblk, dqb_valid); + CHECK_MEMBER(obd_dqblk, padding); } -void +static void check_niobuf_remote(void) { BLANK_LINE(); @@ -273,7 +267,7 @@ check_niobuf_remote(void) CHECK_VALUE(OBD_BRW_NOQUOTA); } -void +static void check_ost_body(void) { BLANK_LINE(); @@ -281,7 +275,7 @@ check_ost_body(void) CHECK_MEMBER(ost_body, oa); } -void +static void check_ll_fid(void) { BLANK_LINE(); @@ -291,7 +285,7 @@ check_ll_fid(void) CHECK_MEMBER(ll_fid, f_type); } -void +static void check_mds_status_req(void) { BLANK_LINE(); @@ -300,7 +294,7 @@ check_mds_status_req(void) CHECK_MEMBER(mds_status_req, repbuf); } -void +static void check_mds_body(void) { BLANK_LINE(); @@ -328,6 +322,10 @@ check_mds_body(void) CHECK_MEMBER(mds_body, generation); CHECK_MEMBER(mds_body, suppgid); CHECK_MEMBER(mds_body, eadatasize); + CHECK_MEMBER(mds_body, padding_1); + CHECK_MEMBER(mds_body, padding_2); + CHECK_MEMBER(mds_body, padding_3); + CHECK_MEMBER(mds_body, padding_4); CHECK_VALUE(FMODE_READ); CHECK_VALUE(FMODE_WRITE); @@ -342,7 +340,7 @@ check_mds_body(void) CHECK_VALUE(MDS_OPEN_HAS_EA); } -void +static void check_mds_rec_setattr(void) { BLANK_LINE(); @@ -364,7 +362,7 @@ check_mds_rec_setattr(void) CHECK_MEMBER(mds_rec_setattr, sa_attr_flags); } -void +static void check_mds_rec_create(void) { BLANK_LINE(); @@ -382,7 +380,7 @@ check_mds_rec_create(void) CHECK_MEMBER(mds_rec_create, cr_suppgid); } -void +static void check_mds_rec_link(void) { BLANK_LINE(); @@ -398,7 +396,7 @@ check_mds_rec_link(void) CHECK_MEMBER(mds_rec_link, lk_time); } -void +static void check_mds_rec_unlink(void) { BLANK_LINE(); @@ -414,7 +412,7 @@ check_mds_rec_unlink(void) CHECK_MEMBER(mds_rec_unlink, ul_time); } -void +static void check_mds_rec_rename(void) { BLANK_LINE(); @@ -430,7 +428,7 @@ check_mds_rec_rename(void) CHECK_MEMBER(mds_rec_rename, rn_time); } -void +static void check_lov_desc(void) { BLANK_LINE(); @@ -441,10 +439,15 @@ check_lov_desc(void) CHECK_MEMBER(lov_desc, ld_pattern); CHECK_MEMBER(lov_desc, ld_default_stripe_size); CHECK_MEMBER(lov_desc, ld_default_stripe_offset); + CHECK_MEMBER(lov_desc, ld_default_stripe_offset); + CHECK_MEMBER(lov_desc, ld_padding_1); + CHECK_MEMBER(lov_desc, ld_padding_2); + CHECK_MEMBER(lov_desc, ld_padding_3); + CHECK_MEMBER(lov_desc, ld_padding_4); CHECK_MEMBER(lov_desc, ld_uuid); } -void +static void check_ldlm_res_id(void) { BLANK_LINE(); @@ -452,7 +455,7 @@ check_ldlm_res_id(void) CHECK_MEMBER(ldlm_res_id, name[RES_NAME_SIZE]); } -void +static void check_ldlm_extent(void) { BLANK_LINE(); @@ -462,7 +465,7 @@ check_ldlm_extent(void) CHECK_MEMBER(ldlm_extent, gid); } -void +static void check_ldlm_flock(void) { BLANK_LINE(); @@ -473,7 +476,7 @@ check_ldlm_flock(void) CHECK_MEMBER(ldlm_flock, pid); } -void +static void check_ldlm_intent(void) { BLANK_LINE(); @@ -481,16 +484,17 @@ check_ldlm_intent(void) CHECK_MEMBER(ldlm_intent, opc); } -void +static void check_ldlm_resource_desc(void) { BLANK_LINE(); CHECK_STRUCT(ldlm_resource_desc); CHECK_MEMBER(ldlm_resource_desc, lr_type); + CHECK_MEMBER(ldlm_resource_desc, lr_padding); CHECK_MEMBER(ldlm_resource_desc, lr_name); } -void +static void check_ldlm_lock_desc(void) { BLANK_LINE(); @@ -501,30 +505,32 @@ check_ldlm_lock_desc(void) CHECK_MEMBER(ldlm_lock_desc, l_policy_data); } -void +static void check_ldlm_request(void) { BLANK_LINE(); CHECK_STRUCT(ldlm_request); CHECK_MEMBER(ldlm_request, lock_flags); + CHECK_MEMBER(ldlm_request, lock_padding); CHECK_MEMBER(ldlm_request, lock_desc); CHECK_MEMBER(ldlm_request, lock_handle1); CHECK_MEMBER(ldlm_request, lock_handle2); } -void +static void check_ldlm_reply(void) { BLANK_LINE(); CHECK_STRUCT(ldlm_reply); CHECK_MEMBER(ldlm_reply, lock_flags); + CHECK_MEMBER(ldlm_request, lock_padding); CHECK_MEMBER(ldlm_request, lock_desc); CHECK_MEMBER(ldlm_reply, lock_handle); CHECK_MEMBER(ldlm_reply, lock_policy_res1); CHECK_MEMBER(ldlm_reply, lock_policy_res2); } -void +static void check_ldlm_lvb(void) { BLANK_LINE(); @@ -536,39 +542,8 @@ check_ldlm_lvb(void) CHECK_MEMBER(ost_lvb, lvb_blocks); } -void -check_ptlbd_op(void) -{ - BLANK_LINE(); - CHECK_STRUCT(ptlbd_op); - CHECK_MEMBER(ptlbd_op, op_cmd); - CHECK_MEMBER(ptlbd_op, op_lun); - CHECK_MEMBER(ptlbd_op, op_niob_cnt); - CHECK_MEMBER(ptlbd_op, op__padding); - CHECK_MEMBER(ptlbd_op, op_block_cnt); -} -void -check_ptlbd_niob(void) -{ - BLANK_LINE(); - CHECK_STRUCT(ptlbd_niob); - CHECK_MEMBER(ptlbd_niob, n_xid); - CHECK_MEMBER(ptlbd_niob, n_block_nr); - CHECK_MEMBER(ptlbd_niob, n_offset); - CHECK_MEMBER(ptlbd_niob, n_length); -} - -void -check_ptlbd_rsp(void) -{ - BLANK_LINE(); - CHECK_STRUCT(ptlbd_rsp); - CHECK_MEMBER(ptlbd_rsp, r_status); - CHECK_MEMBER(ptlbd_rsp, r_error_cnt); -} - -void +static void check_llog_logid(void) { BLANK_LINE(); @@ -588,15 +563,18 @@ check_llog_logid(void) CHECK_VALUE(LLOG_LOGID_MAGIC); } -void +static void check_llog_catid(void) { BLANK_LINE(); CHECK_STRUCT(llog_catid); CHECK_MEMBER(llog_catid, lci_logid); + CHECK_MEMBER(llog_catid, lci_padding1); + CHECK_MEMBER(llog_catid, lci_padding2); + CHECK_MEMBER(llog_catid, lci_padding3); } -void +static void check_llog_rec_hdr(void) { BLANK_LINE(); @@ -604,9 +582,10 @@ check_llog_rec_hdr(void) CHECK_MEMBER(llog_rec_hdr, lrh_len); CHECK_MEMBER(llog_rec_hdr, lrh_index); CHECK_MEMBER(llog_rec_hdr, lrh_type); + CHECK_MEMBER(llog_rec_hdr, padding); } -void +static void check_llog_rec_tail(void) { BLANK_LINE(); @@ -615,17 +594,22 @@ check_llog_rec_tail(void) CHECK_MEMBER(llog_rec_tail, lrt_index); } -void +static void check_llog_logid_rec(void) { BLANK_LINE(); CHECK_STRUCT(llog_logid_rec); CHECK_MEMBER(llog_logid_rec, lid_hdr); CHECK_MEMBER(llog_logid_rec, lid_id); + CHECK_MEMBER(llog_logid_rec, padding1); + CHECK_MEMBER(llog_logid_rec, padding2); + CHECK_MEMBER(llog_logid_rec, padding3); + CHECK_MEMBER(llog_logid_rec, padding4); + CHECK_MEMBER(llog_logid_rec, padding5); CHECK_MEMBER(llog_logid_rec, lid_tail); } -void +static void check_llog_create_rec(void) { BLANK_LINE(); @@ -634,9 +618,10 @@ check_llog_create_rec(void) CHECK_MEMBER(llog_create_rec, lcr_fid); CHECK_MEMBER(llog_create_rec, lcr_oid); CHECK_MEMBER(llog_create_rec, lcr_ogen); + CHECK_MEMBER(llog_create_rec, padding); } -void +static void check_llog_orphan_rec(void) { BLANK_LINE(); @@ -644,10 +629,11 @@ check_llog_orphan_rec(void) CHECK_MEMBER(llog_orphan_rec, lor_hdr); CHECK_MEMBER(llog_orphan_rec, lor_oid); CHECK_MEMBER(llog_orphan_rec, lor_ogen); + CHECK_MEMBER(llog_orphan_rec, padding); CHECK_MEMBER(llog_orphan_rec, lor_tail); } -void +static void check_llog_unlink_rec(void) { BLANK_LINE(); @@ -655,10 +641,25 @@ check_llog_unlink_rec(void) CHECK_MEMBER(llog_unlink_rec, lur_hdr); CHECK_MEMBER(llog_unlink_rec, lur_oid); CHECK_MEMBER(llog_unlink_rec, lur_ogen); + CHECK_MEMBER(llog_unlink_rec, padding); CHECK_MEMBER(llog_unlink_rec, lur_tail); } -void +static void +check_llog_setattr_rec(void) +{ + BLANK_LINE(); + CHECK_STRUCT(llog_setattr_rec); + CHECK_MEMBER(llog_setattr_rec, lsr_hdr); + CHECK_MEMBER(llog_setattr_rec, lsr_oid); + CHECK_MEMBER(llog_setattr_rec, lsr_ogen); + CHECK_MEMBER(llog_setattr_rec, lsr_uid); + CHECK_MEMBER(llog_setattr_rec, lsr_gid); + CHECK_MEMBER(llog_setattr_rec, padding); + CHECK_MEMBER(llog_setattr_rec, lsr_tail); +} + +static void check_llog_size_change_rec(void) { BLANK_LINE(); @@ -666,10 +667,11 @@ check_llog_size_change_rec(void) CHECK_MEMBER(llog_size_change_rec, lsc_hdr); CHECK_MEMBER(llog_size_change_rec, lsc_fid); CHECK_MEMBER(llog_size_change_rec, lsc_io_epoch); + CHECK_MEMBER(llog_size_change_rec, padding); CHECK_MEMBER(llog_size_change_rec, lsc_tail); } -void +static void check_llog_gen(void) { BLANK_LINE(); @@ -678,7 +680,7 @@ check_llog_gen(void) CHECK_MEMBER(llog_gen, conn_cnt); } -void +static void check_llog_gen_rec(void) { BLANK_LINE(); @@ -688,7 +690,7 @@ check_llog_gen_rec(void) CHECK_MEMBER(llog_gen_rec, lgr_tail); } -void +static void check_llog_log_hdr(void) { BLANK_LINE(); @@ -706,7 +708,7 @@ check_llog_log_hdr(void) CHECK_MEMBER(llog_log_hdr, llh_tail); } -void +static void check_llog_cookie(void) { BLANK_LINE(); @@ -714,9 +716,10 @@ check_llog_cookie(void) CHECK_MEMBER(llog_cookie, lgc_lgl); CHECK_MEMBER(llog_cookie, lgc_subsys); CHECK_MEMBER(llog_cookie, lgc_index); + CHECK_MEMBER(llog_cookie, lgc_padding); } -void +static void check_llogd_body(void) { BLANK_LINE(); @@ -738,7 +741,7 @@ check_llogd_body(void) CHECK_VALUE(LLOG_CATINFO); } -void +static void check_llogd_conn_body(void) { BLANK_LINE(); @@ -748,7 +751,7 @@ check_llogd_conn_body(void) CHECK_MEMBER(llogd_conn_body, lgdc_ctxt_idx); } -void +static void check_qunit_data(void) { BLANK_LINE(); @@ -759,7 +762,7 @@ check_qunit_data(void) CHECK_MEMBER(qunit_data, qd_isblk); } -void +static void system_string (char *cmdline, char *str, int len) { int fds[2]; @@ -910,6 +913,7 @@ main(int argc, char **argv) CHECK_VALUE(LDLM_CANCEL); CHECK_VALUE(LDLM_BL_CALLBACK); CHECK_VALUE(LDLM_CP_CALLBACK); + CHECK_VALUE(LDLM_GL_CALLBACK); CHECK_VALUE(LDLM_LAST_OPC); CHECK_VALUE(LCK_EX); @@ -918,14 +922,8 @@ main(int argc, char **argv) CHECK_VALUE(LCK_CW); CHECK_VALUE(LCK_CR); CHECK_VALUE(LCK_NL); - - CHECK_VALUE(PTLBD_QUERY); - CHECK_VALUE(PTLBD_READ); - CHECK_VALUE(PTLBD_WRITE); - CHECK_VALUE(PTLBD_FLUSH); - CHECK_VALUE(PTLBD_CONNECT); - CHECK_VALUE(PTLBD_DISCONNECT); - CHECK_VALUE(PTLBD_LAST_OPC); + CHECK_VALUE(LCK_GROUP); + CHECK_VALUE(LCK_MAXMODE); CHECK_VALUE(MGMT_CONNECT); CHECK_VALUE(MGMT_DISCONNECT); @@ -942,6 +940,14 @@ main(int argc, char **argv) CHECK_VALUE(QUOTA_DQACQ); CHECK_VALUE(QUOTA_DQREL); + CHECK_VALUE(OBD_CONNECT_RDONLY); + CHECK_VALUE(OBD_CONNECT_INDEX); + CHECK_VALUE(OBD_CONNECT_GRANT); + CHECK_VALUE(OBD_CONNECT_SRVLOCK); + CHECK_VALUE(OBD_CONNECT_ACL); + CHECK_VALUE(OBD_CONNECT_XATTR); + CHECK_VALUE(OBD_CONNECT_CROW); + COMMENT("Sizes and Offsets"); BLANK_LINE(); check_lustre_handle(); @@ -971,9 +977,6 @@ main(int argc, char **argv) check_ldlm_request(); check_ldlm_reply(); check_ldlm_lvb(); - check_ptlbd_op(); - check_ptlbd_niob(); - check_ptlbd_rsp(); check_llog_logid(); check_llog_catid(); check_llog_rec_hdr(); @@ -982,6 +985,7 @@ main(int argc, char **argv) check_llog_create_rec(); check_llog_orphan_rec(); check_llog_unlink_rec(); + check_llog_setattr_rec(); check_llog_size_change_rec(); check_llog_gen(); check_llog_gen_rec(); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index c698d01..193049a 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -25,8 +25,8 @@ int main() void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' - * running on Linux mustang 2.6.12-1.1456_FC4smp #1 SMP Thu Sep 22 02:22:14 EDT 2005 i686 i68 - * with gcc version 4.0.1 20050727 (Red Hat 4.0.1-5) */ + * running on Linux schatzie.adilger.int 2.6.12-1.1378_FC3 #1 Wed Sep 14 04:24:31 EDT 2005 i6 + * with gcc version 3.3.4 20040817 (Red Hat Linux 3.3.4-2) */ /* Constants... */ @@ -170,6 +170,8 @@ void lustre_assert_wire_constants(void) (long long)LDLM_BL_CALLBACK); LASSERTF(LDLM_CP_CALLBACK == 105, " found %lld\n", (long long)LDLM_CP_CALLBACK); + LASSERTF(LDLM_GL_CALLBACK == 106, " found %lld\n", + (long long)LDLM_GL_CALLBACK); LASSERTF(LDLM_LAST_OPC == 107, " found %lld\n", (long long)LDLM_LAST_OPC); LASSERTF(LCK_EX == 1, " found %lld\n", @@ -184,20 +186,10 @@ void lustre_assert_wire_constants(void) (long long)LCK_CR); LASSERTF(LCK_NL == 32, " found %lld\n", (long long)LCK_NL); - LASSERTF(PTLBD_QUERY == 200, " found %lld\n", - (long long)PTLBD_QUERY); - LASSERTF(PTLBD_READ == 201, " found %lld\n", - (long long)PTLBD_READ); - LASSERTF(PTLBD_WRITE == 202, " found %lld\n", - (long long)PTLBD_WRITE); - LASSERTF(PTLBD_FLUSH == 203, " found %lld\n", - (long long)PTLBD_FLUSH); - LASSERTF(PTLBD_CONNECT == 204, " found %lld\n", - (long long)PTLBD_CONNECT); - LASSERTF(PTLBD_DISCONNECT == 205, " found %lld\n", - (long long)PTLBD_DISCONNECT); - LASSERTF(PTLBD_LAST_OPC == 206, " found %lld\n", - (long long)PTLBD_LAST_OPC); + LASSERTF(LCK_GROUP == 64, " found %lld\n", + (long long)LCK_GROUP); + LASSERTF(LCK_MAXMODE == 65, " found %lld\n", + (long long)LCK_MAXMODE); LASSERTF(MGMT_CONNECT == 250, " found %lld\n", (long long)MGMT_CONNECT); LASSERTF(MGMT_DISCONNECT == 251, " found %lld\n", @@ -222,6 +214,20 @@ void lustre_assert_wire_constants(void) (long long)QUOTA_DQACQ); LASSERTF(QUOTA_DQREL == 602, " found %lld\n", (long long)QUOTA_DQREL); + LASSERTF(OBD_CONNECT_RDONLY == 1, " found %lld\n", + (long long)OBD_CONNECT_RDONLY); + LASSERTF(OBD_CONNECT_INDEX == 2, " found %lld\n", + (long long)OBD_CONNECT_INDEX); + LASSERTF(OBD_CONNECT_GRANT == 8, " found %lld\n", + (long long)OBD_CONNECT_GRANT); + LASSERTF(OBD_CONNECT_SRVLOCK == 16, " found %lld\n", + (long long)OBD_CONNECT_SRVLOCK); + LASSERTF(OBD_CONNECT_ACL == 128, " found %lld\n", + (long long)OBD_CONNECT_ACL); + LASSERTF(OBD_CONNECT_XATTR == 256, " found %lld\n", + (long long)OBD_CONNECT_XATTR); + LASSERTF(OBD_CONNECT_CROW == 512, " found %lld\n", + (long long)OBD_CONNECT_CROW); /* Sizes and Offsets */ @@ -368,6 +374,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_mds)); LASSERTF((int)sizeof(((struct obdo *)0)->o_mds) == 4, " found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_mds)); + LASSERTF((int)offsetof(struct obdo, o_padding_1) == 120, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_padding_1)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_padding_1)); + LASSERTF((int)offsetof(struct obdo, o_padding_2) == 124, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_padding_2)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_padding_2)); LASSERTF((int)offsetof(struct obdo, o_inline) == 128, " found %lld\n", (long long)(int)offsetof(struct obdo, o_inline)); LASSERTF((int)sizeof(((struct obdo *)0)->o_inline) == 80, " found %lld\n", @@ -660,6 +674,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obd_dqblk, dqb_valid)); LASSERTF((int)sizeof(((struct obd_dqblk *)0)->dqb_valid) == 4, " found %lld\n", (long long)(int)sizeof(((struct obd_dqblk *)0)->dqb_valid)); + LASSERTF((int)offsetof(struct obd_dqblk, padding) == 68, " found %lld\n", + (long long)(int)offsetof(struct obd_dqblk, padding)); + LASSERTF((int)sizeof(((struct obd_dqblk *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obd_dqblk *)0)->padding)); /* Checks for struct niobuf_remote */ LASSERTF((int)sizeof(struct niobuf_remote) == 16, " found %lld\n", @@ -818,6 +836,22 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct mds_body, eadatasize)); LASSERTF((int)sizeof(((struct mds_body *)0)->eadatasize) == 4, " found %lld\n", (long long)(int)sizeof(((struct mds_body *)0)->eadatasize)); + LASSERTF((int)offsetof(struct mds_body, padding_1) == 152, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_1)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_1)); + LASSERTF((int)offsetof(struct mds_body, padding_2) == 156, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_2)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_2)); + LASSERTF((int)offsetof(struct mds_body, padding_3) == 160, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_3)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_3)); + LASSERTF((int)offsetof(struct mds_body, padding_4) == 164, " found %lld\n", + (long long)(int)offsetof(struct mds_body, padding_4)); + LASSERTF((int)sizeof(((struct mds_body *)0)->padding_4) == 4, " found %lld\n", + (long long)(int)sizeof(((struct mds_body *)0)->padding_4)); LASSERTF(FMODE_READ == 1, " found %lld\n", (long long)FMODE_READ); LASSERTF(FMODE_WRITE == 2, " found %lld\n", @@ -1100,6 +1134,26 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_desc, ld_default_stripe_offset)); LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n", (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset)); + LASSERTF((int)offsetof(struct lov_desc, ld_default_stripe_offset) == 24, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_default_stripe_offset)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset) == 8, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_default_stripe_offset)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_1) == 32, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_1)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_1)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_2) == 36, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_2)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_2)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_3) == 40, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_3)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_3)); + LASSERTF((int)offsetof(struct lov_desc, ld_padding_4) == 44, " found %lld\n", + (long long)(int)offsetof(struct lov_desc, ld_padding_4)); + LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_padding_4) == 4, " found %lld\n", + (long long)(int)sizeof(((struct lov_desc *)0)->ld_padding_4)); LASSERTF((int)offsetof(struct lov_desc, ld_uuid) == 48, " found %lld\n", (long long)(int)offsetof(struct lov_desc, ld_uuid)); LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, " found %lld\n", @@ -1164,6 +1218,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ldlm_resource_desc, lr_type)); LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_type) == 4, " found %lld\n", (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_type)); + LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_padding) == 4, " found %lld\n", + (long long)(int)offsetof(struct ldlm_resource_desc, lr_padding)); + LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_resource_desc *)0)->lr_padding)); LASSERTF((int)offsetof(struct ldlm_resource_desc, lr_name) == 8, " found %lld\n", (long long)(int)offsetof(struct ldlm_resource_desc, lr_name)); LASSERTF((int)sizeof(((struct ldlm_resource_desc *)0)->lr_name) == 32, " found %lld\n", @@ -1196,6 +1254,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ldlm_request, lock_flags)); LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_flags) == 4, " found %lld\n", (long long)(int)sizeof(((struct ldlm_request *)0)->lock_flags)); + LASSERTF((int)offsetof(struct ldlm_request, lock_padding) == 4, " found %lld\n", + (long long)(int)offsetof(struct ldlm_request, lock_padding)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_padding)); LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", (long long)(int)offsetof(struct ldlm_request, lock_desc)); LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", @@ -1216,6 +1278,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ldlm_reply, lock_flags)); LASSERTF((int)sizeof(((struct ldlm_reply *)0)->lock_flags) == 4, " found %lld\n", (long long)(int)sizeof(((struct ldlm_reply *)0)->lock_flags)); + LASSERTF((int)offsetof(struct ldlm_request, lock_padding) == 4, " found %lld\n", + (long long)(int)offsetof(struct ldlm_request, lock_padding)); + LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct ldlm_request *)0)->lock_padding)); LASSERTF((int)offsetof(struct ldlm_request, lock_desc) == 8, " found %lld\n", (long long)(int)offsetof(struct ldlm_request, lock_desc)); LASSERTF((int)sizeof(((struct ldlm_request *)0)->lock_desc) == 80, " found %lld\n", @@ -1257,62 +1323,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct ost_lvb *)0)->lvb_blocks) == 8, " found %lld\n", (long long)(int)sizeof(((struct ost_lvb *)0)->lvb_blocks)); - /* Checks for struct ptlbd_op */ - LASSERTF((int)sizeof(struct ptlbd_op) == 12, " found %lld\n", - (long long)(int)sizeof(struct ptlbd_op)); - LASSERTF((int)offsetof(struct ptlbd_op, op_cmd) == 0, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_cmd)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_cmd) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_cmd)); - LASSERTF((int)offsetof(struct ptlbd_op, op_lun) == 2, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_lun)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_lun) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_lun)); - LASSERTF((int)offsetof(struct ptlbd_op, op_niob_cnt) == 4, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_niob_cnt)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_niob_cnt)); - LASSERTF((int)offsetof(struct ptlbd_op, op__padding) == 6, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op__padding)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op__padding) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op__padding)); - LASSERTF((int)offsetof(struct ptlbd_op, op_block_cnt) == 8, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_op, op_block_cnt)); - LASSERTF((int)sizeof(((struct ptlbd_op *)0)->op_block_cnt) == 4, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_op *)0)->op_block_cnt)); - - /* Checks for struct ptlbd_niob */ - LASSERTF((int)sizeof(struct ptlbd_niob) == 24, " found %lld\n", - (long long)(int)sizeof(struct ptlbd_niob)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_xid) == 0, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_xid)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_xid) == 8, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_xid)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_block_nr) == 8, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_block_nr)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_block_nr) == 8, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_block_nr)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_offset) == 16, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_offset)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_offset) == 4, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_offset)); - LASSERTF((int)offsetof(struct ptlbd_niob, n_length) == 20, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_niob, n_length)); - LASSERTF((int)sizeof(((struct ptlbd_niob *)0)->n_length) == 4, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_niob *)0)->n_length)); - - /* Checks for struct ptlbd_rsp */ - LASSERTF((int)sizeof(struct ptlbd_rsp) == 4, " found %lld\n", - (long long)(int)sizeof(struct ptlbd_rsp)); - LASSERTF((int)offsetof(struct ptlbd_rsp, r_status) == 0, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_rsp, r_status)); - LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_status) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_status)); - LASSERTF((int)offsetof(struct ptlbd_rsp, r_error_cnt) == 2, " found %lld\n", - (long long)(int)offsetof(struct ptlbd_rsp, r_error_cnt)); - LASSERTF((int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt) == 2, " found %lld\n", - (long long)(int)sizeof(((struct ptlbd_rsp *)0)->r_error_cnt)); - /* Checks for struct llog_logid */ LASSERTF((int)sizeof(struct llog_logid) == 20, " found %lld\n", (long long)(int)sizeof(struct llog_logid)); @@ -1354,6 +1364,18 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_catid, lci_logid)); LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n", (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid)); + LASSERTF((int)offsetof(struct llog_catid, lci_padding1) == 20, " found %lld\n", + (long long)(int)offsetof(struct llog_catid, lci_padding1)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_padding1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_padding1)); + LASSERTF((int)offsetof(struct llog_catid, lci_padding2) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_catid, lci_padding2)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_padding2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_padding2)); + LASSERTF((int)offsetof(struct llog_catid, lci_padding3) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_catid, lci_padding3)); + LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_padding3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_catid *)0)->lci_padding3)); /* Checks for struct llog_rec_hdr */ LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n", @@ -1370,6 +1392,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_rec_hdr, lrh_type)); LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->lrh_type) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_rec_hdr *)0)->lrh_type)); + LASSERTF((int)offsetof(struct llog_rec_hdr, padding) == 12, " found %lld\n", + (long long)(int)offsetof(struct llog_rec_hdr, padding)); + LASSERTF((int)sizeof(((struct llog_rec_hdr *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_rec_hdr *)0)->padding)); /* Checks for struct llog_rec_tail */ LASSERTF((int)sizeof(struct llog_rec_tail) == 8, " found %lld\n", @@ -1394,6 +1420,26 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_logid_rec, lid_id)); LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n", (long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding1) == 36, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding1)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding1) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding1)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding2) == 40, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding2)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding2) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding2)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding3) == 44, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding3)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding3) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding3)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding4) == 48, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding4)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding4) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding4)); + LASSERTF((int)offsetof(struct llog_logid_rec, padding5) == 52, " found %lld\n", + (long long)(int)offsetof(struct llog_logid_rec, padding5)); + LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->padding5) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_logid_rec *)0)->padding5)); LASSERTF((int)offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n", (long long)(int)offsetof(struct llog_logid_rec, lid_tail)); LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n", @@ -1418,6 +1464,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_create_rec, lcr_ogen)); LASSERTF((int)sizeof(((struct llog_create_rec *)0)->lcr_ogen) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_create_rec *)0)->lcr_ogen)); + LASSERTF((int)offsetof(struct llog_create_rec, padding) == 44, " found %lld\n", + (long long)(int)offsetof(struct llog_create_rec, padding)); + LASSERTF((int)sizeof(((struct llog_create_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_create_rec *)0)->padding)); /* Checks for struct llog_orphan_rec */ LASSERTF((int)sizeof(struct llog_orphan_rec) == 40, " found %lld\n", @@ -1434,6 +1484,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_orphan_rec, lor_ogen)); LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_orphan_rec *)0)->lor_ogen)); + LASSERTF((int)offsetof(struct llog_orphan_rec, padding) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_orphan_rec, padding)); + LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_orphan_rec *)0)->padding)); LASSERTF((int)offsetof(struct llog_orphan_rec, lor_tail) == 32, " found %lld\n", (long long)(int)offsetof(struct llog_orphan_rec, lor_tail)); LASSERTF((int)sizeof(((struct llog_orphan_rec *)0)->lor_tail) == 8, " found %lld\n", @@ -1454,11 +1508,47 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_unlink_rec, lur_ogen)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_ogen)); + LASSERTF((int)offsetof(struct llog_unlink_rec, padding) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_unlink_rec, padding)); + LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_unlink_rec *)0)->padding)); LASSERTF((int)offsetof(struct llog_unlink_rec, lur_tail) == 32, " found %lld\n", (long long)(int)offsetof(struct llog_unlink_rec, lur_tail)); LASSERTF((int)sizeof(((struct llog_unlink_rec *)0)->lur_tail) == 8, " found %lld\n", (long long)(int)sizeof(((struct llog_unlink_rec *)0)->lur_tail)); + /* Checks for struct llog_setattr_rec */ + LASSERTF((int)sizeof(struct llog_setattr_rec) == 48, " found %lld\n", + (long long)(int)sizeof(struct llog_setattr_rec)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_hdr) == 0, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_hdr)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_hdr) == 16, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_hdr)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_oid) == 16, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_oid)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_oid)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_ogen) == 24, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_ogen)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_ogen)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_uid) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_uid)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_uid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_uid)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_gid) == 32, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_gid)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_gid) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_gid)); + LASSERTF((int)offsetof(struct llog_setattr_rec, padding) == 36, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, padding)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->padding)); + LASSERTF((int)offsetof(struct llog_setattr_rec, lsr_tail) == 40, " found %lld\n", + (long long)(int)offsetof(struct llog_setattr_rec, lsr_tail)); + LASSERTF((int)sizeof(((struct llog_setattr_rec *)0)->lsr_tail) == 8, " found %lld\n", + (long long)(int)sizeof(((struct llog_setattr_rec *)0)->lsr_tail)); + /* Checks for struct llog_size_change_rec */ LASSERTF((int)sizeof(struct llog_size_change_rec) == 48, " found %lld\n", (long long)(int)sizeof(struct llog_size_change_rec)); @@ -1474,6 +1564,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_size_change_rec, lsc_io_epoch)); LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_size_change_rec *)0)->lsc_io_epoch)); + LASSERTF((int)offsetof(struct llog_size_change_rec, padding) == 36, " found %lld\n", + (long long)(int)offsetof(struct llog_size_change_rec, padding)); + LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_size_change_rec *)0)->padding)); LASSERTF((int)offsetof(struct llog_size_change_rec, lsc_tail) == 40, " found %lld\n", (long long)(int)offsetof(struct llog_size_change_rec, lsc_tail)); LASSERTF((int)sizeof(((struct llog_size_change_rec *)0)->lsc_tail) == 8, " found %lld\n", @@ -1570,6 +1664,10 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_cookie, lgc_index)); LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, " found %lld\n", (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index)); + LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, " found %lld\n", + (long long)(int)offsetof(struct llog_cookie, lgc_padding)); + LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, " found %lld\n", + (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding)); /* Checks for struct llogd_body */ LASSERTF((int)sizeof(struct llogd_body) == 48, " found %lld\n", -- 1.8.3.1