From 89e4372b4aed1eaf00c536a1cc78a69394a66c81 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 17 Mar 2004 23:55:43 +0000 Subject: [PATCH] Update b1_2 from HEAD (20040317_1211) b=2399, b=2517, landing b_v26 --- lnet/Rules.linux | 10 +- lnet/archdep.m4 | 11 +- lnet/klnds/socklnd/socklnd.c | 2 +- lnet/klnds/socklnd/socklnd.h | 1 + lnet/utils/debug.c | 112 ++++++++++++++------- lustre/ChangeLog | 2 + lustre/Rules | 19 +++- lustre/include/linux/lustre_compat25.h | 23 +++++ .../patches/linux-2.6.3-CITI_NFS4_ALL.patch | 2 +- lustre/llite/Makefile.am | 11 +- lustre/llite/llite_lib.c | 4 + lustre/llite/rw26.c | 2 +- lustre/llite/super.c | 2 - lustre/llite/super25.c | 3 - lustre/lvfs/Makefile.am | 39 +++++-- lustre/lvfs/fsfilt_ext3.c | 3 +- lustre/lvfs/lvfs_linux.c | 26 +++-- lustre/mds/mds_fs.c | 7 +- lustre/obdclass/Makefile.am | 12 +++ lustre/obdfilter/Makefile.am | 11 +- lustre/obdfilter/filter_io.c | 9 +- lustre/obdfilter/filter_io_24.c | 5 - lustre/obdfilter/filter_io_26.c | 8 +- lustre/ost/ost_handler.c | 6 +- lustre/portals/Rules.linux | 10 +- lustre/portals/archdep.m4 | 11 +- lustre/portals/knals/socknal/socknal.c | 2 +- lustre/portals/knals/socknal/socknal.h | 1 + lustre/portals/utils/debug.c | 112 ++++++++++++++------- lustre/ptlrpc/recover.c | 10 +- lustre/scripts/merge1.sh | 2 +- lustre/tests/.RC_CURRENT.tag | 2 +- 32 files changed, 326 insertions(+), 154 deletions(-) diff --git a/lnet/Rules.linux b/lnet/Rules.linux index 93943b7..232a248 100644 --- a/lnet/Rules.linux +++ b/lnet/Rules.linux @@ -3,11 +3,15 @@ if LINUX25 -basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g') +basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g' | sed -e 's/^.*\///g') AM_CPPFLAGS= -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -DKBUILD_MODNAME=$(MODULE) -DKBUILD_BASENAME=$(basename) -$(MODULE).o: $($(MODULE)_OBJECTS) - $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $($(MODULE)_OBJECTS) +$(MODULE).o: $($(MODULE)_OBJECTS) $($(MODULE)_DEPENDENCIES) + $(LD) -m $(MOD_LINK) -r -o $(MODULE)_tmp.o $($(MODULE)_OBJECTS) + rm -f $(MODULE)_tmp.c + $(LINUX)/scripts/modpost $(LINUX)/vmlinux $(MODULE)_tmp.o + $(COMPILE) -UKBUILD_BASENAME -DKBUILD_BASENAME=$(MODULE) -c $(MODULE)_tmp.mod.c + $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $(MODULE)_tmp.o $(MODULE)_tmp.mod.o else diff --git a/lnet/archdep.m4 b/lnet/archdep.m4 index 7801957..65cfaff 100644 --- a/lnet/archdep.m4 +++ b/lnet/archdep.m4 @@ -65,7 +65,7 @@ case ${host_cpu} in KCFLAGS='-g -Wall -pipe -Wno-trigraphs -Wstrict-prototypes -fno-strict-aliasing -fno-common ' case ${linux25} in yes ) - KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) ' + KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include' ;; * ) KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/include ' @@ -206,11 +206,10 @@ if test $host_cpu != "lib" ; then AC_MSG_CHECKING(for MODVERSIONS) if egrep -e 'MODVERSIONS.*1' $LINUX/include/linux/autoconf.h >/dev/null 2>&1; then - MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB" - AC_MSG_RESULT(yes) - else - MFLAGS= - AC_MSG_RESULT(no) + if test $linux25 != "yes"; then + MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB" + AC_MSG_RESULT(yes) + fi fi fi diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index 2c44b43..0dd5d11 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -196,7 +196,7 @@ ksocknal_bind_irq (unsigned int irq) /* FIXME: Find a better method of setting IRQ affinity... */ - call_usermodehelper (argv[0], argv, envp); + USERMODEHELPER(argv[0], argv, envp); #endif } diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h index db8c842..17a7e49 100644 --- a/lnet/klnds/socklnd/socklnd.h +++ b/lnet/klnds/socklnd/socklnd.h @@ -60,6 +60,7 @@ #define DEBUG_SUBSYSTEM S_SOCKNAL #include +#include #include #include #include diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index 01e690f..69880ea 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -43,10 +43,10 @@ #include #include -#define BUG() /* workaround for module.h includes */ #include #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#define BUG() /* workaround for module.h includes */ #include #endif @@ -524,41 +524,43 @@ int jt_dbg_mark_debug_buf(int argc, char **argv) return 0; } +static struct mod_paths { + char *name, *path; +} mod_paths[] = { + {"portals", "lustre/portals/libcfs"}, + {"ksocknal", "lustre/portals/knals/socknal"}, + {"kptlrouter", "lustre/portals/router"}, + {"lvfs", "lustre/lvfs"}, + {"obdclass", "lustre/obdclass"}, + {"llog_test", "lustre/obdclass"}, + {"ptlrpc", "lustre/ptlrpc"}, + {"obdext2", "lustre/obdext2"}, + {"ost", "lustre/ost"}, + {"osc", "lustre/osc"}, + {"mds", "lustre/mds"}, + {"mdc", "lustre/mdc"}, + {"llite", "lustre/llite"}, + {"obdecho", "lustre/obdecho"}, + {"ldlm", "lustre/ldlm"}, + {"obdfilter", "lustre/obdfilter"}, + {"extN", "lustre/extN"}, + {"lov", "lustre/lov"}, + {"fsfilt_ext3", "lustre/lvfs"}, + {"fsfilt_extN", "lustre/lvfs"}, + {"fsfilt_reiserfs", "lustre/lvfs"}, + {"mds_ext2", "lustre/mds"}, + {"mds_ext3", "lustre/mds"}, + {"mds_extN", "lustre/mds"}, + {"ptlbd", "lustre/ptlbd"}, + {"mgmt_svc", "lustre/mgmt"}, + {"mgmt_cli", "lustre/mgmt"}, + {NULL, NULL} +}; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) int jt_dbg_modules(int argc, char **argv) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - struct mod_paths { - char *name, *path; - } *mp, mod_paths[] = { - {"portals", "lustre/portals/libcfs"}, - {"ksocknal", "lustre/portals/knals/socknal"}, - {"kptlrouter", "lustre/portals/router"}, - {"lvfs", "lustre/lvfs"}, - {"obdclass", "lustre/obdclass"}, - {"llog_test", "lustre/obdclass"}, - {"ptlrpc", "lustre/ptlrpc"}, - {"obdext2", "lustre/obdext2"}, - {"ost", "lustre/ost"}, - {"osc", "lustre/osc"}, - {"mds", "lustre/mds"}, - {"mdc", "lustre/mdc"}, - {"llite", "lustre/llite"}, - {"obdecho", "lustre/obdecho"}, - {"ldlm", "lustre/ldlm"}, - {"obdfilter", "lustre/obdfilter"}, - {"extN", "lustre/extN"}, - {"lov", "lustre/lov"}, - {"fsfilt_ext3", "lustre/lvfs"}, - {"fsfilt_extN", "lustre/lvfs"}, - {"fsfilt_reiserfs", "lustre/lvfs"}, - {"mds_ext2", "lustre/mds"}, - {"mds_ext3", "lustre/mds"}, - {"mds_extN", "lustre/mds"}, - {"ptlbd", "lustre/ptlbd"}, - {"mgmt_svc", "lustre/mgmt"}, - {"mgmt_cli", "lustre/mgmt"}, - {NULL, NULL} - }; + struct mod_paths *mp; char *path = ".."; char *kernel = "linux"; @@ -592,11 +594,49 @@ int jt_dbg_modules(int argc, char **argv) } return 0; +} #else - printf("jt_dbg_module is not yet implemented for Linux 2.5\n"); +int jt_dbg_modules(int argc, char **argv) +{ + struct mod_paths *mp; + char *path = ".."; + char *kernel = "linux"; + const char *proc = "/proc/modules"; + char modname[128], others[128]; + long modaddr; + int rc; + FILE *file; + + if (argc >= 2) + path = argv[1]; + if (argc == 3) + kernel = argv[2]; + if (argc > 3) { + printf("%s [path] [kernel]\n", argv[0]); + return 0; + } + + file = fopen(proc, "r"); + if (!file) { + printf("failed open %s: %s\n", proc, strerror(errno)); + return 0; + } + + while ((rc = fscanf(file, "%s %s %s %s %s %lx\n", + modname, others, others, others, others, &modaddr)) == 6) { + for (mp = mod_paths; mp->name != NULL; mp++) { + if (!strcmp(mp->name, modname)) + break; + } + if (mp->name) { + printf("add-symbol-file %s/%s/%s.o 0x%0lx\n", path, + mp->path, mp->name, modaddr); + } + } + return 0; -#endif /* linux 2.5 */ } +#endif /* linux 2.5 */ int jt_dbg_panic(int argc, char **argv) { diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 00cb256..f2477a7 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -18,6 +18,8 @@ tbd Cluster File Systems, Inc. - hold dentry reference for closed log files for unlink (2325) - reserve space for all logs during transactions (2059) - don't evict page beyond end of stripe extent (2925) + - don't oops on a deleted current working directory (2399) + - handle hard links to targets without a parent properly (2517) 2004-03-04 Cluster File Systems, Inc. * version 1.2.0 diff --git a/lustre/Rules b/lustre/Rules index b28540a..8846e3b 100644 --- a/lustre/Rules +++ b/lustre/Rules @@ -12,18 +12,29 @@ if LINUX25 -# We still need to link each module with vermagic.o to get rid of "kernel taited" warnings. -basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g') +# FIXME +# need to be rewritten: +# - bad hacking in lvfs/Makefile.am obdclass/Makefile.am +# - .o -> .ko +# +basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g' | sed -e 's/^.*\///g') AM_CPPFLAGS=-I$(top_builddir)/include -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -DKBUILD_MODNAME=$(MODULE) -DKBUILD_BASENAME=$(basename) +$(MODULE).o: $($(MODULE)_OBJECTS) $($(MODULE)_DEPENDENCIES) + $(LD) -m $(MOD_LINK) -r -o $(MODULE)_tmp.o $($(MODULE)_OBJECTS) + rm -f $(MODULE)_tmp.c + $(LINUX)/scripts/modpost $(LINUX)/vmlinux $(MODULE)_tmp.o + $(COMPILE) -UKBUILD_BASENAME -DKBUILD_BASENAME=$(MODULE) -c $(MODULE)_tmp.mod.c + $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $(MODULE)_tmp.o $(MODULE)_tmp.mod.o + else AM_CPPFLAGS=-I$(top_builddir)/include +$(MODULE).o: $($(MODULE)_OBJECTS) $($(MODULE)_DEPENDENCIES) + $(LD) -m "`$(LD) --help | awk '/supported emulations/ {print $$4}'`" -r -o $(MODULE).o $($(MODULE)_OBJECTS) endif -$(MODULE).o: $($(MODULE)_OBJECTS) $($(MODULE)_DEPENDENCIES) - $(LD) -m "`$(LD) --help | awk '/supported emulations/ {print $$4}'`" -r -o $(MODULE).o $($(MODULE)_OBJECTS) tags: rm -f $(top_srcdir)/TAGS diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index df59db4..4a4e3a0 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -85,6 +85,21 @@ static inline void lustre_daemonize_helper(void) current->tty = NULL; } +static inline int cleanup_group_info(void) +{ + struct group_info *ginfo; + + ginfo = groups_alloc(2); + if (!ginfo) + return -ENOMEM; + + ginfo->ngroups = 0; + set_current_groups(ginfo); + put_group_info(ginfo); + + return 0; +} + #define smp_num_cpus NR_CPUS #ifndef conditional_schedule @@ -160,6 +175,14 @@ static inline void lustre_daemonize_helper(void) current->tty = NULL; } +static inline int cleanup_group_info(void) +{ + /* Get rid of unneeded supplementary groups */ + current->ngroups = 0; + memset(current->groups, 0, sizeof(current->groups)); + return 0; +} + #ifndef conditional_schedule #define conditional_schedule() if (unlikely(need_resched())) schedule() #endif diff --git a/lustre/kernel_patches/patches/linux-2.6.3-CITI_NFS4_ALL.patch b/lustre/kernel_patches/patches/linux-2.6.3-CITI_NFS4_ALL.patch index 16e191b..fd46189 100644 --- a/lustre/kernel_patches/patches/linux-2.6.3-CITI_NFS4_ALL.patch +++ b/lustre/kernel_patches/patches/linux-2.6.3-CITI_NFS4_ALL.patch @@ -5336,7 +5336,7 @@ diff -puN /dev/null include/linux/sunrpc/svcauth_gss.h + * Bruce Fields + * Copyright (c) 2002 The Regents of the Unviersity of Michigan + * -+ * $Id: linux-2.6.3-CITI_NFS4_ALL.patch,v 1.2 2004/03/17 01:04:13 nic Exp $ ++ * $Id: linux-2.6.3-CITI_NFS4_ALL.patch,v 1.2.4.1 2004/03/17 23:55:23 adilger Exp $ + * + */ + diff --git a/lustre/llite/Makefile.am b/lustre/llite/Makefile.am index 2253f66..493d95c 100644 --- a/lustre/llite/Makefile.am +++ b/lustre/llite/Makefile.am @@ -9,8 +9,13 @@ MODULE = llite modulefs_DATA = llite.o EXTRA_PROGRAMS = llite -llite_SOURCES = dcache.c dir.c file.c llite_close.c llite_lib.c llite_nfs.c -llite_SOURCES += lproc_llite.c namei.c rw.c rw24.c super.c super25.c -llite_SOURCES += symlink.c sysctl.c llite_internal.h +COMMON_SRC = dcache.c dir.c file.c llite_close.c llite_lib.c llite_nfs.c rw.c \ + lproc_llite.c namei.c symlink.c sysctl.c llite_internal.h + +if LINUX25 +llite_SOURCES = $(COMMON_SRC) rw26.c super25.c +else +llite_SOURCES = $(COMMON_SRC) rw24.c super.c +endif include $(top_srcdir)/Rules diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index c9cf119..8ae804e 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -192,8 +192,12 @@ int lustre_common_fill_super(struct super_block *sb, char *mdc, char *osc) GOTO(out_root, err); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) +#warning "Please fix this" +#else /* bug 2805 - set VM readahead to zero */ vm_max_readahead = vm_min_readahead = 0; +#endif sb->s_root = d_alloc_root(root); RETURN(err); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 640cf05..c8c7cbb 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -139,7 +139,7 @@ struct address_space_operations ll_aops = { writepage: ll_writepage_26, writepages: generic_writepages, set_page_dirty: __set_page_dirty_nobuffers, - sync_page: ll_sync_page, + sync_page: NULL, prepare_write: ll_prepare_write, commit_write: ll_commit_write, removepage: ll_removepage, diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 80a6938..57ceb3f 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -34,7 +34,6 @@ #include #include "llite_internal.h" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) extern struct address_space_operations ll_aops; extern struct address_space_operations ll_dir_aops; @@ -141,4 +140,3 @@ MODULE_LICENSE("GPL"); module_init(init_lustre_lite); module_exit(exit_lustre_lite); -#endif diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 233035f..ee340b9 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -34,8 +34,6 @@ #include #include "llite_internal.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) - struct super_block * ll_get_sb(struct file_system_type *fs_type, int flags, const char *devname, void * data) { @@ -170,4 +168,3 @@ MODULE_LICENSE("GPL"); module_init(init_lustre_lite); module_exit(exit_lustre_lite); -#endif diff --git a/lustre/lvfs/Makefile.am b/lustre/lvfs/Makefile.am index eb9609c..9e91de3 100644 --- a/lustre/lvfs/Makefile.am +++ b/lustre/lvfs/Makefile.am @@ -3,15 +3,6 @@ # This code is issued under the GNU General Public License. # See the file COPYING in this distribution DEFS= -MODULE = lvfs - - -if EXTN -FSMOD = fsfilt_extN -else -FSMOD = fsfilt_ext3 -endif - if LIBLUSTRE noinst_LIBRARIES = liblvfs.a @@ -23,13 +14,39 @@ liblvfs_a_CFLAGS = -fPIC #endif else -modulefs_DATA = lvfs.o $(FSMOD).o fsfilt_reiserfs.o -EXTRA_PROGRAMS = lvfs $(FSMOD) fsfilt_reiserfs +MODULE = lvfs + +if EXTN +FSMOD = fsfilt_extN +else +FSMOD = fsfilt_ext3 +endif + +modulefs_DATA = lvfs.o $(FSMOD).o + +EXTRA_PROGRAMS = lvfs $(FSMOD) lvfs_SOURCES = lvfs_common.c lvfs_linux.c fsfilt.c lvfs_internal.h +if EXTN +fsfilt_extN_SOURCES = fsfilt_extN.c lvfs_internal.h +else +fsfilt_ext3_SOURCES = fsfilt_ext3.c lvfs_internal.h +endif endif fsfilt_extN.c: fsfilt_ext3.c sed -e "s/EXT3/EXTN/g" -e "s/ext3/extN/g" $< > $@ include $(top_srcdir)/Rules + +if LINUX25 +# workaround for fsfilt_ext3 +$(FSMOD).o: $(FSMOD).c + $(COMPILE) -UKBUILD_MODNAME -DKBUILD_MODNAME=$(FSMOD) -c -o $(FSMOD)_tmp.o $< + rm -f $(FSMOD)_tmp.c + $(LINUX)/scripts/modpost $(LINUX)/vmlinux $(FSMOD)_tmp.o + $(COMPILE) -UKBUILD_MODNAME -UKBUILD_BASENAME -DKBUILD_BASENAME=$(FSMOD) \ + -c $(FSMOD)_tmp.mod.c + $(LD) -m "`$(LD) --help | awk '/supported emulations/ {print $$4}'`" -r \ + -o $(FSMOD).o $(FSMOD)_tmp.o $(FSMOD)_tmp.mod.o +endif diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 224afd4..25eb31c 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -25,6 +25,8 @@ #define DEBUG_SUBSYSTEM S_FILTER +#include +#include #include #include #include @@ -43,7 +45,6 @@ #include #include #include -#include static kmem_cache_t *fcb_cache; static atomic_t fcb_cache_count = ATOMIC_INIT(0); diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index 7f381d3..1e58081 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -65,6 +65,14 @@ int obd_memmax; # define ASSERT_KERNEL_CTXT(msg) do {} while(0) #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) +#define current_ngroups current->group_info->ngroups +#define current_groups current->group_info->small_block +#else +#define current_ngroups current->ngroups +#define current_groups current->groups +#endif + /* push / pop to root of obd store */ void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx, struct obd_ucred *uc) @@ -89,7 +97,7 @@ void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx, LASSERT(atomic_read(&new_ctx->pwd->d_count)); save->pwd = dget(current->fs->pwd); save->pwdmnt = mntget(current->fs->pwdmnt); - save->ngroups = current->ngroups; + save->ngroups = current_ngroups; LASSERT(save->pwd); LASSERT(save->pwdmnt); @@ -100,18 +108,18 @@ void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx, save->ouc.ouc_fsuid = current->fsuid; save->ouc.ouc_fsgid = current->fsgid; save->ouc.ouc_cap = current->cap_effective; - save->ouc.ouc_suppgid1 = current->groups[0]; - save->ouc.ouc_suppgid2 = current->groups[1]; + save->ouc.ouc_suppgid1 = current_groups[0]; + save->ouc.ouc_suppgid2 = current_groups[1]; current->fsuid = uc->ouc_fsuid; current->fsgid = uc->ouc_fsgid; current->cap_effective = uc->ouc_cap; - current->ngroups = 0; + current_ngroups = 0; if (uc->ouc_suppgid1 != -1) - current->groups[current->ngroups++] = uc->ouc_suppgid1; + current_groups[current_ngroups++] = uc->ouc_suppgid1; if (uc->ouc_suppgid2 != -1) - current->groups[current->ngroups++] = uc->ouc_suppgid2; + current_groups[current_ngroups++] = uc->ouc_suppgid2; } set_fs(new_ctx->fs); set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd); @@ -160,9 +168,9 @@ void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx, current->fsuid = saved->ouc.ouc_fsuid; current->fsgid = saved->ouc.ouc_fsgid; current->cap_effective = saved->ouc.ouc_cap; - current->ngroups = saved->ngroups; - current->groups[0] = saved->ouc.ouc_suppgid1; - current->groups[1] = saved->ouc.ouc_suppgid2; + current_ngroups = saved->ngroups; + current_groups[0] = saved->ouc.ouc_suppgid1; + current_groups[1] = saved->ouc.ouc_suppgid2; } /* diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 5e098ae..ad8cadc 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -370,10 +370,9 @@ int mds_fs_setup(struct obd_device *obd, struct vfsmount *mnt) int rc; ENTRY; - - /* Get rid of unneeded supplementary groups */ - current->ngroups = 0; - memset(current->groups, 0, sizeof(current->groups)); + rc = cleanup_group_info(); + if (rc) + RETURN(rc); mds->mds_vfsmnt = mnt; mds->mds_sb = mnt->mnt_root->d_inode->i_sb; diff --git a/lustre/obdclass/Makefile.am b/lustre/obdclass/Makefile.am index 9fc783b..4451952 100644 --- a/lustre/obdclass/Makefile.am +++ b/lustre/obdclass/Makefile.am @@ -37,3 +37,15 @@ lustre_build_version: endif include $(top_srcdir)/Rules + +if LINUX25 +# workaround for llog_test +llog_test.o: llog_test.c + $(COMPILE) -UKBUILD_MODNAME -DKBUILD_MODNAME=llog_test -c -o llog_test_tmp.o $< + rm -f llog_test_tmp.c + $(LINUX)/scripts/modpost $(LINUX)/vmlinux llog_test_tmp.o + $(COMPILE) -UKBUILD_MODNAME -UKBUILD_BASENAME -DKBUILD_BASENAME=llog_test \ + -c llog_test_tmp.mod.c + $(LD) -m "`$(LD) --help | awk '/supported emulations/ {print $$4}'`" -r \ + -o llog_test.o llog_test_tmp.o llog_test_tmp.mod.o +endif diff --git a/lustre/obdfilter/Makefile.am b/lustre/obdfilter/Makefile.am index 18fd5f3..afa74fd 100644 --- a/lustre/obdfilter/Makefile.am +++ b/lustre/obdfilter/Makefile.am @@ -6,7 +6,14 @@ MODULE = obdfilter modulefs_DATA = obdfilter.o EXTRA_PROGRAMS = obdfilter -obdfilter_SOURCES = filter.c filter_io.c filter_log.c filter_san.c \ - filter_io_24.c lproc_obdfilter.c filter_internal.h filter_lvb.c + +COMMON_SRC = filter.c filter_io.c filter_log.c filter_san.c lproc_obdfilter.c \ + filter_internal.h filter_lvb.c + +if LINUX25 +obdfilter_SOURCES = $(COMMON_SRC) filter_io_26.c +else +obdfilter_SOURCES = $(COMMON_SRC) filter_io_24.c +endif include $(top_srcdir)/Rules diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index b9e6600..773baf4 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -235,10 +235,13 @@ long filter_grant(struct obd_export *exp, obd_size current_grant, * avoid overgranting in face of multiple RPCs in flight). This * essentially will be able to control the OSC_MAX_RIF for a client. * - * If we do have a large disparity and multiple RPCs in flight we - * might grant "too much" but that's OK because it means we are - * dirtying a lot on the client and will likely use it up quickly. */ + * If we do have a large disparity between what the client thinks it + * has and what we think it has, don't grant very much and let the + * client consume its grant first. Either it just has lots of RPCs + * in flight, or it was evicted and its grants will soon be used up. */ if (current_grant < want) { + if (current_grant > fed->fed_grant + FILTER_GRANT_CHUNK) + want = 65536; grant = min((want >> blockbits) / 2, (fs_space_left >> blockbits) / 8); grant <<= blockbits; diff --git a/lustre/obdfilter/filter_io_24.c b/lustre/obdfilter/filter_io_24.c index 15ac8e9..a3464f3 100644 --- a/lustre/obdfilter/filter_io_24.c +++ b/lustre/obdfilter/filter_io_24.c @@ -29,8 +29,6 @@ #include // XXX kill me soon #include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - #define DEBUG_SUBSYSTEM S_FILTER #include @@ -345,6 +343,3 @@ cleanup: RETURN(rc); } - -#endif - diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index 95c96e6..5ce65c7 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -97,7 +97,8 @@ static int filter_range_is_mapped(struct inode *inode, obd_size offset, int len) int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, int niocount, - struct niobuf_local *res, struct obd_trans_info *oti) + struct niobuf_local *res, struct obd_trans_info *oti, + int rc) { struct obd_device *obd = exp->exp_obd; struct obd_run_ctxt saved; @@ -105,7 +106,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, struct fsfilt_objinfo fso; struct iattr iattr = { .ia_valid = ATTR_SIZE, .ia_size = 0, }; struct inode *inode = NULL; - int rc = 0, i, k, cleanup_phase = 0, err; + int i, k, cleanup_phase = 0, err; unsigned long now = jiffies; /* DEBUGGING OST TIMEOUTS */ int blocks_per_page; struct dio_request *dreq; @@ -115,6 +116,9 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount, LASSERT(objcount == 1); LASSERT(current->journal_info == NULL); + if (rc != 0) + GOTO(cleanup, rc); + inode = res->dentry->d_inode; blocks_per_page = PAGE_SIZE >> inode->i_blkbits; LASSERT(blocks_per_page <= MAX_BLOCKS_PER_PAGE); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 3771ded..1359623 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1124,9 +1124,9 @@ static int ost_setup(struct obd_device *obddev, obd_count len, void *buf) int rc; ENTRY; - /* Get rid of unneeded supplementary groups */ - current->ngroups = 0; - memset(current->groups, 0, sizeof(current->groups)); + rc = cleanup_group_info(); + if (rc) + RETURN(rc); rc = llog_start_commit_thread(); if (rc < 0) diff --git a/lustre/portals/Rules.linux b/lustre/portals/Rules.linux index 93943b7..232a248 100644 --- a/lustre/portals/Rules.linux +++ b/lustre/portals/Rules.linux @@ -3,11 +3,15 @@ if LINUX25 -basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g') +basename=$(shell echo $< | sed -e 's/\.c//g' | sed -e 's/-//g' | sed -e 's/\.o//g' | sed -e 's/^.*\///g') AM_CPPFLAGS= -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -DKBUILD_MODNAME=$(MODULE) -DKBUILD_BASENAME=$(basename) -$(MODULE).o: $($(MODULE)_OBJECTS) - $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $($(MODULE)_OBJECTS) +$(MODULE).o: $($(MODULE)_OBJECTS) $($(MODULE)_DEPENDENCIES) + $(LD) -m $(MOD_LINK) -r -o $(MODULE)_tmp.o $($(MODULE)_OBJECTS) + rm -f $(MODULE)_tmp.c + $(LINUX)/scripts/modpost $(LINUX)/vmlinux $(MODULE)_tmp.o + $(COMPILE) -UKBUILD_BASENAME -DKBUILD_BASENAME=$(MODULE) -c $(MODULE)_tmp.mod.c + $(LD) -m $(MOD_LINK) -r -o $(MODULE).o $(MODULE)_tmp.o $(MODULE)_tmp.mod.o else diff --git a/lustre/portals/archdep.m4 b/lustre/portals/archdep.m4 index 7801957..65cfaff 100644 --- a/lustre/portals/archdep.m4 +++ b/lustre/portals/archdep.m4 @@ -65,7 +65,7 @@ case ${host_cpu} in KCFLAGS='-g -Wall -pipe -Wno-trigraphs -Wstrict-prototypes -fno-strict-aliasing -fno-common ' case ${linux25} in yes ) - KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include -DKBUILD_BASENAME=$(MODULE) -DKBUILD_MODNAME=$(MODULE) ' + KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include' ;; * ) KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/include ' @@ -206,11 +206,10 @@ if test $host_cpu != "lib" ; then AC_MSG_CHECKING(for MODVERSIONS) if egrep -e 'MODVERSIONS.*1' $LINUX/include/linux/autoconf.h >/dev/null 2>&1; then - MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB" - AC_MSG_RESULT(yes) - else - MFLAGS= - AC_MSG_RESULT(no) + if test $linux25 != "yes"; then + MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB" + AC_MSG_RESULT(yes) + fi fi fi diff --git a/lustre/portals/knals/socknal/socknal.c b/lustre/portals/knals/socknal/socknal.c index 2c44b43..0dd5d11 100644 --- a/lustre/portals/knals/socknal/socknal.c +++ b/lustre/portals/knals/socknal/socknal.c @@ -196,7 +196,7 @@ ksocknal_bind_irq (unsigned int irq) /* FIXME: Find a better method of setting IRQ affinity... */ - call_usermodehelper (argv[0], argv, envp); + USERMODEHELPER(argv[0], argv, envp); #endif } diff --git a/lustre/portals/knals/socknal/socknal.h b/lustre/portals/knals/socknal/socknal.h index db8c842..17a7e49 100644 --- a/lustre/portals/knals/socknal/socknal.h +++ b/lustre/portals/knals/socknal/socknal.h @@ -60,6 +60,7 @@ #define DEBUG_SUBSYSTEM S_SOCKNAL #include +#include #include #include #include diff --git a/lustre/portals/utils/debug.c b/lustre/portals/utils/debug.c index 01e690f..69880ea 100644 --- a/lustre/portals/utils/debug.c +++ b/lustre/portals/utils/debug.c @@ -43,10 +43,10 @@ #include #include -#define BUG() /* workaround for module.h includes */ #include #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#define BUG() /* workaround for module.h includes */ #include #endif @@ -524,41 +524,43 @@ int jt_dbg_mark_debug_buf(int argc, char **argv) return 0; } +static struct mod_paths { + char *name, *path; +} mod_paths[] = { + {"portals", "lustre/portals/libcfs"}, + {"ksocknal", "lustre/portals/knals/socknal"}, + {"kptlrouter", "lustre/portals/router"}, + {"lvfs", "lustre/lvfs"}, + {"obdclass", "lustre/obdclass"}, + {"llog_test", "lustre/obdclass"}, + {"ptlrpc", "lustre/ptlrpc"}, + {"obdext2", "lustre/obdext2"}, + {"ost", "lustre/ost"}, + {"osc", "lustre/osc"}, + {"mds", "lustre/mds"}, + {"mdc", "lustre/mdc"}, + {"llite", "lustre/llite"}, + {"obdecho", "lustre/obdecho"}, + {"ldlm", "lustre/ldlm"}, + {"obdfilter", "lustre/obdfilter"}, + {"extN", "lustre/extN"}, + {"lov", "lustre/lov"}, + {"fsfilt_ext3", "lustre/lvfs"}, + {"fsfilt_extN", "lustre/lvfs"}, + {"fsfilt_reiserfs", "lustre/lvfs"}, + {"mds_ext2", "lustre/mds"}, + {"mds_ext3", "lustre/mds"}, + {"mds_extN", "lustre/mds"}, + {"ptlbd", "lustre/ptlbd"}, + {"mgmt_svc", "lustre/mgmt"}, + {"mgmt_cli", "lustre/mgmt"}, + {NULL, NULL} +}; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) int jt_dbg_modules(int argc, char **argv) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - struct mod_paths { - char *name, *path; - } *mp, mod_paths[] = { - {"portals", "lustre/portals/libcfs"}, - {"ksocknal", "lustre/portals/knals/socknal"}, - {"kptlrouter", "lustre/portals/router"}, - {"lvfs", "lustre/lvfs"}, - {"obdclass", "lustre/obdclass"}, - {"llog_test", "lustre/obdclass"}, - {"ptlrpc", "lustre/ptlrpc"}, - {"obdext2", "lustre/obdext2"}, - {"ost", "lustre/ost"}, - {"osc", "lustre/osc"}, - {"mds", "lustre/mds"}, - {"mdc", "lustre/mdc"}, - {"llite", "lustre/llite"}, - {"obdecho", "lustre/obdecho"}, - {"ldlm", "lustre/ldlm"}, - {"obdfilter", "lustre/obdfilter"}, - {"extN", "lustre/extN"}, - {"lov", "lustre/lov"}, - {"fsfilt_ext3", "lustre/lvfs"}, - {"fsfilt_extN", "lustre/lvfs"}, - {"fsfilt_reiserfs", "lustre/lvfs"}, - {"mds_ext2", "lustre/mds"}, - {"mds_ext3", "lustre/mds"}, - {"mds_extN", "lustre/mds"}, - {"ptlbd", "lustre/ptlbd"}, - {"mgmt_svc", "lustre/mgmt"}, - {"mgmt_cli", "lustre/mgmt"}, - {NULL, NULL} - }; + struct mod_paths *mp; char *path = ".."; char *kernel = "linux"; @@ -592,11 +594,49 @@ int jt_dbg_modules(int argc, char **argv) } return 0; +} #else - printf("jt_dbg_module is not yet implemented for Linux 2.5\n"); +int jt_dbg_modules(int argc, char **argv) +{ + struct mod_paths *mp; + char *path = ".."; + char *kernel = "linux"; + const char *proc = "/proc/modules"; + char modname[128], others[128]; + long modaddr; + int rc; + FILE *file; + + if (argc >= 2) + path = argv[1]; + if (argc == 3) + kernel = argv[2]; + if (argc > 3) { + printf("%s [path] [kernel]\n", argv[0]); + return 0; + } + + file = fopen(proc, "r"); + if (!file) { + printf("failed open %s: %s\n", proc, strerror(errno)); + return 0; + } + + while ((rc = fscanf(file, "%s %s %s %s %s %lx\n", + modname, others, others, others, others, &modaddr)) == 6) { + for (mp = mod_paths; mp->name != NULL; mp++) { + if (!strcmp(mp->name, modname)) + break; + } + if (mp->name) { + printf("add-symbol-file %s/%s/%s.o 0x%0lx\n", path, + mp->path, mp->name, modaddr); + } + } + return 0; -#endif /* linux 2.5 */ } +#endif /* linux 2.5 */ int jt_dbg_panic(int argc, char **argv) { diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index 1ff5f30..c3ab04d 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -347,28 +347,26 @@ static int ptlrpc_recover_import_no_retry(struct obd_import *imp, spin_lock_irqsave(&imp->imp_lock, flags); if (imp->imp_state != LUSTRE_IMP_DISCON) { in_recovery = 1; - } + } spin_unlock_irqrestore(&imp->imp_lock, flags); if (in_recovery == 1) RETURN(-EALREADY); - rc = ptlrpc_connect_import(imp, new_uuid); if (rc) RETURN(rc); - CDEBUG(D_ERROR, "%s: recovery started, waiting\n", + CDEBUG(D_ERROR, "%s: recovery started, waiting\n", imp->imp_target_uuid.uuid); lwi = LWI_TIMEOUT(MAX(obd_timeout * HZ, 1), NULL, NULL); - rc = l_wait_event(imp->imp_recovery_waitq, + rc = l_wait_event(imp->imp_recovery_waitq, !ptlrpc_import_in_recovery(imp), &lwi); - CDEBUG(D_ERROR, "%s: recovery finished\n", + CDEBUG(D_ERROR, "%s: recovery finished\n", imp->imp_target_uuid.uuid); RETURN(rc); - } void ptlrpc_fail_export(struct obd_export *exp) diff --git a/lustre/scripts/merge1.sh b/lustre/scripts/merge1.sh index d7e0069..9bdc9b5 100755 --- a/lustre/scripts/merge1.sh +++ b/lustre/scripts/merge1.sh @@ -1,7 +1,7 @@ #!/bin/sh -e CONFLICTS=cvs-merge-conflicts -CVS=cvs +CVS="cvs -z3" if [ -f .mergeinfo ] ; then echo ".mergeinfo exists - clean up first" diff --git a/lustre/tests/.RC_CURRENT.tag b/lustre/tests/.RC_CURRENT.tag index b480257..25cb73f 100644 --- a/lustre/tests/.RC_CURRENT.tag +++ b/lustre/tests/.RC_CURRENT.tag @@ -1 +1 @@ -RC_1_3_0_5 +RC_1_3_0_6 -- 1.8.3.1