Lustre fixes and cleanups
cover Lustre fixes and cleanups
Hello!
This pile of patches brings in most of the recent fixes from current Lustre development tree, also code cleanups, junk removal and such.
A relatively unsynced area remaining is in client io stack that is undergoing some major shakeups now, I'll try to tackle it later once things actually settle down some more.
There are several checkpatch warnings in this patchset that I am not sure what to do aobut since the messages printed are genuinely long:
WARNING: quoted string split across lines
#61: FILE: drivers/staging/lustre/lustre/ptlrpc/import.c:1424:
+ CERROR("%s: don't know how to disconnect from %s "
+ "(connect_op %d): rc = %d\n",
total: 0 errors, 1 warnings, 73 lines checked
0009-staging-lustre-ptlrpc-don-t-try-to-recover-no_recov-.patch has style problems, please review.
WARNING: quoted string split across lines
#311: FILE: drivers/staging/lustre/lustre/lov/lov_ea.c:352:
+ CDEBUG(level, "lsm %p, objid "DOSTID", maxbytes "LPX64", magic 0x%08X,"
+ " stripe_size %u, stripe_count %u, refc: %d,"
WARNING: quoted string split across lines
#312: FILE: drivers/staging/lustre/lustre/lov/lov_ea.c:353:
+ " stripe_size %u, stripe_count %u, refc: %d,"
+ " layout_gen %u, pool ["LOV_POOLNAMEF"]\n", lsm,
total: 0 errors, 2 warnings, 337 lines checked 0016-staging-lustre-obdclass-remove-uses-of-lov_stripe_md.patch has style problems, please review.
WARNING: line over 80 characters
#110: FILE: drivers/staging/lustre/lustre/llite/statahead.c:1311:
+ CDEBUG(D_READA, "stop statahead thread: sai %p pid %u\n",
WARNING: quoted string split across lines
#120: FILE: drivers/staging/lustre/lustre/llite/statahead.c:1486:
", sent/replied "LPU64"/"LPU64", stopping "
+ "statahead thread\n",
total: 0 errors, 2 warnings, 94 lines checked
0025-stagaing-lustre-Improve-statahead-debug-messages.patch has style problems, please review.
WARNING: quoted string split across lines
#43: FILE: drivers/staging/lustre/lustre/llite/llite_lib.c:2461:
+ "%s: dirty page discard: %s/fid: "DFID"/%s may get corrupted "
+ "(rc %d)\n", ll_get_fsname(page->mapping->host->i_sb, NULL, 0),
total: 0 errors, 1 warnings, 17 lines checked
0037-staging-lustre-llite-Do-not-rate-limit-dirty-page-di.patch has style problems, please review.
Please consider for merging.
Bye,
Oleg
Andreas Dilger (4):
staging/lustre/ptlrpc: don't try to recover no_recov connection staging/lustre: quiet console permission error messages staging/lustre: shrink lu_object_header by 8 bytes on x86_64 staging/lustre: pass fsync() range through RPC/IO stack
Andrew Korty (2):
staging/lustre/gss: gssnull security flavor staging/lustre/gss: Shared key mechanism & flavors
Andriy Skulysh (1):
staging/lustre/ptlrpc: add rpc_cache
Ann Koehler (1):
staging/lustre: restore __GFP_WAIT flag to memalloc calls
Bob Glossman (1):
staging/lustre/lloop: avoid panic during blockdev_info
Bobi Jam (3):
staging/lustre/llite: issue OST_SYNC for fsync() staging/lustre/llite: deadlock taking lli_trunc_sem during file write staging/lustre/llite: prevent buffer overflow in fiemap
Brian Behlendorf (1):
staging/lustre: Limit reply buffer size
Cheng Shao (1):
staging/lustre/ptlrpc: Remove log message about export timer update
Christopher J. Morrone (2):
staging/lustre/llite: Avoid statahead thread start/stop deadlocks stagaing/lustre: Improve statahead debug messages
Dmitry Eremin (8):
staging/lustre/gss: fix few issues found by Klocwork Insight tool staging/lustre/gss: fix uninitialized variable staging/lustre/ldlm: fix NULL pointer dereference staging/lustre/lnet: lnet: fix issues found by Klocwork Insight tool staging/lustre/mdc: fix issue found by Klocwork Insight tool staging/lustre/libcfs: fix issues found by Klocwork Insight tool staging/lustre: replace semaphores with mutexes staging/lustre/clio: replace semaphore with mutex
Hongchao Zhang (1):
staging/lustre/osc: don't activate deactivated obd_import
James Nunez (1):
staging/lustre/hsm: HSM requests not delivered
Jinshan Xiong (3):
staging/lustre/lov: to not hold sub locks at initialization staging/lustre/llite: access layout version under a lock staging/lustre/clio: Solve a race in cl_lock_put
John L. Hammond (4):
staging/lustre/lov: remove unused lov llog code staging/lustre/obdclass: remove uses of lov_stripe_md staging/lustre: remove lustre/include/ioctl.h staging/lustre/llite: remove dead code
Li Xi (4):
staging/lustre/ldlm: Hold lock when clearing flag staging/lustre: fix permission problem of setfacl staging/lustre/libcfs: add CPU table functions for uniprocessor staging/lustre: remove assertion of spin_is_locked()
Liang Zhen (1):
staging/lustre/lnet: NI shutdown may loop forever
Matt Ezell (1):
staging/lustre/lnet: Dropped messages are not accounted correctly
Niu Yawei (1):
staging/lustre/clio: clear nowait flag agl lock re-enqueue
Oleg Drokin (1):
staging/lustre: Fix unsafe userspace access in many proc files
Patrick Farrell (1):
staging/lustre/ptlrpc: Fix assertion failure of null_alloc_rs()
Peng Tao (1):
staging/lustre/hsm: count NULL terminator in hai_zero/hal_size
Ryan Haasken (2):
staging/lustre/llite: Do not rate limit dirty page discard warning staging/lustre: Always clamp cdls_delay between min and max
Swapnil Pimpale (1):
staging/lustre/osc: Update inode timestamp for lockless IO as well
wang di (1):
staging/lustre/mdc: use cl_max_mds_md to pack getattr RPC
.../lustre/include/linux/libcfs/libcfs_cpu.h | 5 + .../lustre/include/linux/libcfs/libcfs_private.h | 4 +- .../lustre/include/linux/libcfs/linux/linux-lock.h | 2 +- .../lustre/include/linux/libcfs/linux/linux-mem.h | 5 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 15 +- drivers/staging/lustre/lnet/lnet/router.c | 3 +- drivers/staging/lustre/lnet/selftest/conctl.c | 11 +- drivers/staging/lustre/lnet/selftest/framework.c | 14 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 41 +++- drivers/staging/lustre/lustre/include/dt_object.h | 9 +- drivers/staging/lustre/lustre/include/ioctl.h | 106 -------- drivers/staging/lustre/lustre/include/lu_object.h | 8 +- .../lustre/lustre/include/lustre/lustre_idl.h | 28 ++- .../lustre/lustre/include/lustre/lustre_user.h | 5 +- .../staging/lustre/lustre/include/lustre_debug.h | 1 - drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 13 - drivers/staging/lustre/lustre/include/lustre_log.h | 10 - drivers/staging/lustre/lustre/include/lustre_mdc.h | 23 +- drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 25 ++ drivers/staging/lustre/lustre/include/obd.h | 24 +- drivers/staging/lustre/lustre/include/obd_class.h | 16 +- drivers/staging/lustre/lustre/include/obd_lov.h | 116 --------- .../staging/lustre/lustre/include/obd_support.h | 10 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 17 +- .../staging/lustre/lustre/lclient/lcommon_misc.c | 15 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 10 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 21 ++ .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 18 +- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 12 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 10 +- drivers/staging/lustre/lustre/llite/dcache.c | 26 +- drivers/staging/lustre/lustre/llite/dir.c | 15 +- drivers/staging/lustre/lustre/llite/file.c | 148 ++++++----- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 177 ++++---------- drivers/staging/lustre/lustre/llite/llite_lib.c | 135 +++++----- drivers/staging/lustre/lustre/llite/llite_mmap.c | 23 +- drivers/staging/lustre/lustre/llite/llite_nfs.c | 4 +- drivers/staging/lustre/lustre/llite/lloop.c | 10 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 149 +++++++++-- drivers/staging/lustre/lustre/llite/namei.c | 40 +-- drivers/staging/lustre/lustre/llite/remote_perm.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 7 - drivers/staging/lustre/lustre/llite/rw26.c | 15 +- drivers/staging/lustre/lustre/llite/statahead.c | 68 +++--- drivers/staging/lustre/lustre/llite/super25.c | 9 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 10 +- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 4 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 35 ++- drivers/staging/lustre/lustre/llite/xattr.c | 5 + drivers/staging/lustre/lustre/llite/xattr_cache.c | 4 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 25 +- drivers/staging/lustre/lustre/lov/Makefile | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 6 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 14 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 37 ++- drivers/staging/lustre/lustre/lov/lov_lock.c | 42 +--- drivers/staging/lustre/lustre/lov/lov_log.c | 272 --------------------- drivers/staging/lustre/lustre/lov/lov_merge.c | 6 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 21 +- drivers/staging/lustre/lustre/lov/lov_object.c | 3 +- drivers/staging/lustre/lustre/lov/lov_offset.c | 1 - drivers/staging/lustre/lustre/lov/lov_pack.c | 10 +- drivers/staging/lustre/lustre/lov/lov_request.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 23 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 11 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 49 +++- drivers/staging/lustre/lustre/mgc/mgc_request.c | 8 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 14 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 4 +- drivers/staging/lustre/lustre/obdclass/debug.c | 12 - drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- .../lustre/lustre/obdclass/linux/linux-module.c | 9 +- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 29 +-- .../staging/lustre/lustre/obdecho/echo_client.c | 9 +- drivers/staging/lustre/lustre/osc/lproc_osc.c | 16 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 4 +- .../staging/lustre/lustre/osc/osc_cl_internal.h | 9 + drivers/staging/lustre/lustre/osc/osc_dev.c | 4 +- drivers/staging/lustre/lustre/osc/osc_io.c | 28 +-- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 1 - drivers/staging/lustre/lustre/ptlrpc/client.c | 50 +++- drivers/staging/lustre/lustre/ptlrpc/events.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/gss/Makefile | 3 +- .../staging/lustre/lustre/ptlrpc/gss/gss_bulk.c | 12 +- .../lustre/lustre/ptlrpc/gss/gss_internal.h | 7 + .../lustre/lustre/ptlrpc/gss/gss_krb5_mech.c | 1 + .../lustre/lustre/ptlrpc/gss/gss_null_mech.c | 195 +++++++++++++++ .../staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c | 4 +- .../staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c | 226 +++++++++++++++++ drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 16 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 36 ++- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 2 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 1 + drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 4 + .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 32 ++- drivers/staging/lustre/lustre/ptlrpc/recover.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 34 ++- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 20 +- 117 files changed, 1509 insertions(+), 1356 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/ioctl.h delete mode 100644 drivers/staging/lustre/lustre/include/obd_lov.h delete mode 100644 drivers/staging/lustre/lustre/lov/lov_log.c create mode 100644 drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c create mode 100644 drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c
Signature · 1 line
1.8.5.3
PATCH 1/47 staging/lustre/ptlrpc: Fix assertion failure of null_alloc_rs()
From: Patrick Farrell <[email protected]>
lustre_get_emerg_rs() set the size of the reply buffer to zero by mistake, which will cause LBUG in null_alloc_rs() when memory pressure is high. This patch fix this problem and adds a size check to avoid the problem of insufficient buffer size.
Reviewed-on: http://review.whamcloud.com/8200
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3680
--- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 1 + drivers/staging/lustre/lustre/ptlrpc/sec.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +1 -0
@@ -300,6 +300,7 @@ lustre_get_emerg_rs(struct ptlrpc_service_part *svcpt)spin_unlock (&svcpt->scp_rep_lock);memset (rs,0 , svcpt->scp_service->srv_max_reply_size); + rs->rs_size = svcpt->scp_service->srv_max_reply_size; rs->rs_svcpt = svcpt; rs->rs_prealloc =1 ; out:
drivers/staging/lustre/lustre/ptlrpc/sec.c +11 -1
@@ -2086,8 +2086,18 @@ int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen) rc = policy->sp_sops->alloc_rs (req, msglen);if (unlikely (rc == -ENOMEM )) { +struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; +if (svcpt->scp_service->srv_max_reply_size < + msglen +sizeof (struct ptlrpc_reply_state )) { +/* Just return failure if the size is too big */ +CERROR ("size of message is too big (%zd), %d allowed" , + msglen +sizeof (struct ptlrpc_reply_state ), + svcpt->scp_service->srv_max_reply_size); +return -ENOMEM ; + } +/* failed alloc, try emergency pool */ - rs =lustre_get_emerg_rs (req->rq_rqbd->rqbd_svcpt); + rs =lustre_get_emerg_rs (svcpt);if (rs ==NULL )return -ENOMEM ;
Signature · 1 line
1.8.5.3
PATCH 2/47 staging/lustre/ptlrpc: Remove log message about export timer update
In reply to Oleg DrokinFrom: Cheng Shao <[email protected]>
Function ptlrpc_update_export_timer generates lots of D_HA level log messages whenever the export timer gets updated. Those log messages are found little use for issue investigations, and it will take space in the Lustre log buffer. We are removing it now.
Xyratex-bug-id: MRP-733
Reviewed-on: http://review.whamcloud.com/9147
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4590
--- drivers/staging/lustre/lustre/ptlrpc/service.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/service.c +0 -3
@@ -1042,9 +1042,6 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay)return ; exp->exp_last_request_time = new_time; -CDEBUG (D_HA ,"updating export %s at " CFS_TIME_T " exp %p\n" , - exp->exp_client_uuid.uuid, - exp->exp_last_request_time, exp);/* exports may get disconnected from the chain even though the export has references, so we must keep the spin lock while
Signature · 1 line
1.8.5.3
PATCH 3/47 staging/lustre/gss: gssnull security flavor
In reply to Oleg DrokinFrom: Andrew Korty <[email protected]>
This change implements the gssnull security flavor for the purpose of testing the Lustre GSS code. It provides and uses a null GSS mechanism so this testing doesn't have to involve any code related to Kerberos or any other authentication method.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3289
Reviewed-on: http://review.whamcloud.com/8475
--- drivers/staging/lustre/lustre/include/lustre_sec.h | 8 + drivers/staging/lustre/lustre/ptlrpc/gss/Makefile | 2 +- .../lustre/lustre/ptlrpc/gss/gss_internal.h | 4 + .../lustre/lustre/ptlrpc/gss/gss_null_mech.c | 195 +++++++++++++++++++++ drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 + 6 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c
drivers/staging/lustre/lustre/include/lustre_sec.h +8 -0
@@ -170,6 +170,8 @@ enum sptlrpc_bulk_service { ((__u32)(mech) | \ ((__u32)(svc) << (FLVR_SVC_OFFSET - FLVR_MECH_OFFSET))) +#define SPTLRPC_SUBFLVR_GSSNULL \ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_NULL, SPTLRPC_SVC_NULL)#define SPTLRPC_SUBFLVR_KRB5N \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_NULL)#define SPTLRPC_SUBFLVR_KRB5A \
@@ -194,6 +196,12 @@ enum sptlrpc_bulk_service { SPTLRPC_SVC_NULL, \ SPTLRPC_BULK_HASH, \ SPTLRPC_BULK_SVC_INTG) +#define SPTLRPC_FLVR_GSSNULL \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_NULL, \ + SPTLRPC_SVC_NULL, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_NULL)#define SPTLRPC_FLVR_KRB5N \ MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5, \
drivers/staging/lustre/lustre/ptlrpc/gss/Makefile +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_LUSTRE_FS) := ptlrpc_gss.o ptlrpc_gss-y := sec_gss.o gss_bulk.o gss_cli_upcall.o gss_svc_upcall.o \ gss_rawobj.o lproc_gss.o gss_generic_token.o \ - gss_mech_switch.o gss_krb5_mech.o + gss_mech_switch.o gss_krb5_mech.o gss_null_mech.o ccflags-y := -I$(src)/../include
drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h +4 -0
@@ -498,6 +498,10 @@ void gss_stat_oos_record_svc(int phase, int replay);int __init gss_init_lproc (void ); void __exit gss_exit_lproc(void); +/* gss_null_mech.c */ +int __init init_null_module (void ); +void cleanup_null_module (void ); +/* gss_krb5_mech.c */ int __init init_kerberos_module (void ); void __exit cleanup_kerberos_module(void);
drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c new file +195 -0
195 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c +7 -1
@@ -2832,10 +2832,14 @@ int __init sptlrpc_gss_init(void)if (rc) goto out_cli_upcall; - rc =init_kerberos_module (); + rc =init_null_module ();if (rc) goto out_svc_upcall; + rc =init_kerberos_module (); +if (rc) + goto out_null; +/* register policy after all other stuff be initialized, because it * might be in used immediately after the registration. */
@@ -2860,6 +2864,8 @@ out_keyring: out_kerberos:cleanup_kerberos_module (); +out_null: +cleanup_null_module (); out_svc_upcall:gss_exit_svc_upcall (); out_cli_upcall:
drivers/staging/lustre/lustre/ptlrpc/sec.c +4 -0
@@ -157,6 +157,8 @@ __u32 sptlrpc_name2flavor_base(const char *name)return SPTLRPC_FLVR_NULL ;if (!strcmp (name,"plain" ))return SPTLRPC_FLVR_PLAIN ; +if (!strcmp (name,"gssnull" )) +return SPTLRPC_FLVR_GSSNULL ;if (!strcmp (name,"krb5n" ))return SPTLRPC_FLVR_KRB5N ;if (!strcmp (name,"krb5a" ))
@@ -178,6 +180,8 @@ const char *sptlrpc_flavor2name_base(__u32 flvr)return "null" ; else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_PLAIN)) return "plain"; + else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_GSSNULL)) + return "gssnull"; else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_KRB5N)) return "krb5n"; else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_KRB5A))
Signature · 1 line
1.8.5.3
PATCH 4/47 staging/lustre/gss: Shared key mechanism & flavors
In reply to Oleg DrokinFrom: Andrew Korty <[email protected]>
Implement security flavors and GSSAPI mechanism to perform shared key authentication (ski) and encryption (skpi).
Reviewed-on: http://review.whamcloud.com/8629
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3289
--- drivers/staging/lustre/lustre/include/lustre_sec.h | 17 ++ drivers/staging/lustre/lustre/ptlrpc/gss/Makefile | 3 +- .../lustre/lustre/ptlrpc/gss/gss_internal.h | 3 + .../staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c | 226 +++++++++++++++++++++ drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 8 + 6 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c
drivers/staging/lustre/lustre/include/lustre_sec.h +17 -0
@@ -103,6 +103,7 @@ enum sptlrpc_mech_plain {enum sptlrpc_mech_gss {SPTLRPC_MECH_GSS_NULL =0 ,SPTLRPC_MECH_GSS_KRB5 =1 , +SPTLRPC_MECH_GSS_SK =2 ,SPTLRPC_MECH_GSS_MAX , };
@@ -180,6 +181,10 @@ enum sptlrpc_bulk_service { MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_INTG)#define SPTLRPC_SUBFLVR_KRB5P \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_PRIV) +#define SPTLRPC_SUBFLVR_SKI \ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_SK, SPTLRPC_SVC_INTG) +#define SPTLRPC_SUBFLVR_SKPI \ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_SK, SPTLRPC_SVC_PRIV)/* * "end user" flavors
@@ -226,6 +231,18 @@ enum sptlrpc_bulk_service { SPTLRPC_SVC_PRIV, \ SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_PRIV) +#define SPTLRPC_FLVR_SKI \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_SK, \ + SPTLRPC_SVC_INTG, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_PRIV) +#define SPTLRPC_FLVR_SKPI \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_SK, \ + SPTLRPC_SVC_PRIV, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_PRIV)#define SPTLRPC_FLVR_DEFAULT SPTLRPC_FLVR_NULL
drivers/staging/lustre/lustre/ptlrpc/gss/Makefile +2 -1
@@ -2,7 +2,8 @@ obj-$(CONFIG_LUSTRE_FS) := ptlrpc_gss.o ptlrpc_gss-y := sec_gss.o gss_bulk.o gss_cli_upcall.o gss_svc_upcall.o \ gss_rawobj.o lproc_gss.o gss_generic_token.o \ - gss_mech_switch.o gss_krb5_mech.o gss_null_mech.o + gss_mech_switch.o gss_krb5_mech.o gss_null_mech.o \ + gss_sk_mech.o ccflags-y := -I$(src)/../include
drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h +3 -0
@@ -506,6 +506,9 @@ void cleanup_null_module(void);int __init init_kerberos_module (void ); void __exit cleanup_kerberos_module(void); +/* gss_sk_mech.c */ +int __init init_sk_module (void ); +void cleanup_sk_module (void );/* debug */ static inline
drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c new file +226 -0
226 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c +7 -1
@@ -2840,12 +2840,16 @@ int __init sptlrpc_gss_init(void)if (rc) goto out_null; + rc =init_sk_module (); +if (rc) + goto out_kerberos; +/* register policy after all other stuff be initialized, because it * might be in used immediately after the registration. */ rc =gss_init_keyring ();if (rc) - goto out_kerberos; + goto out_sk;#ifdef HAVE_GSS_PIPEFS rc =gss_init_pipefs ();
@@ -2862,6 +2866,8 @@ out_keyring:gss_exit_keyring ();#endif +out_sk: +cleanup_sk_module (); out_kerberos:cleanup_kerberos_module (); out_null:
drivers/staging/lustre/lustre/ptlrpc/sec.c +8 -0
@@ -167,6 +167,10 @@ __u32 sptlrpc_name2flavor_base(const char *name)return SPTLRPC_FLVR_KRB5I ;if (!strcmp (name,"krb5p" ))return SPTLRPC_FLVR_KRB5P ; +if (!strcmp (name,"ski" )) +return SPTLRPC_FLVR_SKI ; +if (!strcmp (name,"skpi" )) +return SPTLRPC_FLVR_SKPI ;return SPTLRPC_FLVR_INVALID ; }
@@ -190,6 +194,10 @@ const char *sptlrpc_flavor2name_base(__u32 flvr)return "krb5i" ; else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_KRB5P)) return "krb5p"; + else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_SKI)) + return "ski"; + else if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_SKPI)) + return "skpi";CERROR ("invalid wire flavor 0x%x\n" , flvr);return "invalid" ;
Signature · 1 line
1.8.5.3
Greg Kroah-Hartman
maintainerRe: [PATCH 04/47] staging/lustre/gss: Shared key mechanism & flavors
Quoted 11 lines · Oleg Drokin
From: Andrew Korty <[email protected]>
Implement security flavors and GSSAPI mechanism to perform shared key authentication (ski) and encryption (skpi).
Signed-off-by Andrew Korty <[email protected]>Reviewed-on: http://review.whamcloud.com/8629
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3289Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Ken Hornstein <[email protected]>Signed-off-by Oleg Drokin <[email protected]>
Why are you adding new features to the code?
I really want the code cleaned up properly first, before anything new can be added to it. Otherwise it's just a loosing battle of cleanups needed for the stuff you keep adding.
thanks,
greg k-h
PATCH 5/47 staging/lustre/osc: don't activate deactivated obd_import
In reply to Oleg DrokinFrom: Hongchao Zhang <[email protected]>
In ptlrpc_activate_import(), obd_import->imp_deactive should be checked if it is deactivated, otherwise it will trigger an LBUG in ptlrpc_invalidate_import():
ptlrpc_invalidate_import() ASSERTION(imp->imp_invalid) failed
Reviewed-on: http://review.whamcloud.com/8747
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4386
--- drivers/staging/lustre/lustre/ptlrpc/import.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/lustre/lustre/ptlrpc/import.c +5 -0
@@ -381,6 +381,11 @@ void ptlrpc_activate_import(struct obd_import *imp)struct obd_device *obd = imp->imp_obd;spin_lock (&imp->imp_lock); +if (imp->imp_deactive !=0 ) { +spin_unlock (&imp->imp_lock); +return ; + } + imp->imp_invalid =0 ;spin_unlock (&imp->imp_lock);obd_import_event (obd, imp,IMP_EVENT_ACTIVE );
Signature · 1 line
1.8.5.3
PATCH 6/47 staging/lustre/lnet: Dropped messages are not accounted correctly
In reply to Oleg DrokinFrom: Matt Ezell <[email protected]>
LNET messages that are dropped are not accounted for correctly in /proc/sys/lnet/stats. What I assume to be a simple typo is causing drop_length to be double-counted and drop_count to never be incremented.
Reviewed-on: http://review.whamcloud.com/9096
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4577
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +1 -1
@@ -338,7 +338,7 @@ lnet_counters_get(lnet_counters_t *counters) counters->send_count += ctr->send_count; counters->recv_count += ctr->recv_count; counters->route_count += ctr->route_count; - counters->drop_length += ctr->drop_length; + counters->drop_count += ctr->drop_count; counters->send_length += ctr->send_length; counters->recv_length += ctr->recv_length; counters->route_length += ctr->route_length;
Signature · 1 line
1.8.5.3
PATCH 7/47 staging/lustre/ldlm: Hold lock when clearing flag
In reply to Oleg DrokinFrom: Li Xi <[email protected]>
This patch moves lock's skip flag clearing from lru-delete to lru-add code to prevent clearing lock's flag without resource lock protection.
Reviewed-on: http://review.whamcloud.com/8772
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4269
--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +2 -2
@@ -232,8 +232,6 @@ int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock)LASSERT (lock->l_resource->lr_type !=LDLM_FLOCK );list_del_init (&lock->l_lru); -if (lock->l_flags &LDLM_FL_SKIPPED ) - lock->l_flags &= ~LDLM_FL_SKIPPED ;LASSERT (ns->ns_nr_unused >0 ); ns->ns_nr_unused--; rc =1 ;
@@ -271,6 +269,8 @@ void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock)LASSERT (list_empty (&lock->l_lru));LASSERT (lock->l_resource->lr_type !=LDLM_FLOCK );list_add_tail (&lock->l_lru, &ns->ns_unused_list); +if (lock->l_flags &LDLM_FL_SKIPPED ) + lock->l_flags &= ~LDLM_FL_SKIPPED ;LASSERT (ns->ns_nr_unused >=0 ); ns->ns_nr_unused++; }
Signature · 1 line
1.8.5.3
PATCH 8/47 staging/lustre/clio: clear nowait flag agl lock re-enqueue
In reply to Oleg DrokinFrom: Niu Yawei <[email protected]>
The LDLM_FL_BLOCK_NOWAIT flag should be cleared when re-enqueue the agl lock as normal glimpse, otherwise, it won't get size back if there is conflicting locks on other client.
Reviewed-on: http://review.whamcloud.com/9249
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4597
--- drivers/staging/lustre/lustre/osc/osc_lock.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/osc/osc_lock.c +1 -0
@@ -1192,6 +1192,7 @@ static int osc_lock_wait(const struct lu_env *env,LASSERT (olck->ols_agl); olck->ols_agl =0 ; + olck->ols_flags &= ~LDLM_FL_BLOCK_NOWAIT ; rc =osc_lock_enqueue (env, slice,NULL ,CEF_ASYNC |CEF_MUST );if (rc !=0 )return rc;
Signature · 1 line
1.8.5.3
PATCH 9/47 staging/lustre/ptlrpc: don't try to recover no_recov connection
In reply to Oleg DrokinFrom: Andreas Dilger <[email protected]>
If a connection has been stopped with ptlrpc_pinger_del_import() and marked obd_no_recov, don't reconnect in ptlrpc_disconnect_import() if the import is already disconnected. Otherwise, without the pinger it will just wait there indefinitely for the reconnection that will never happen.
Put the obd_no_recov check inside ptlrpc_import_in_recovery() so that any threads waiting on the connection to recover would also be broken out of their sleep if obd_no_recov is set.
Reviewed-on: http://review.whamcloud.com/8996
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4413
--- drivers/staging/lustre/lustre/ptlrpc/import.c | 29 +++++++++++++++++--------- drivers/staging/lustre/lustre/ptlrpc/recover.c | 5 ++++- 2 files changed, 23 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/import.c +19 -10
@@ -1404,26 +1404,33 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) {struct ptlrpc_request *req;int rq_opc, rc =0 ; -int nowait = imp->imp_obd->obd_force; -if (nowait) +if (imp->imp_obd->obd_force)GOTO (set_state, rc);switch (imp->imp_connect_op) { -case OST_CONNECT : rq_opc =OST_DISCONNECT ;break ; -case MDS_CONNECT : rq_opc =MDS_DISCONNECT ;break ; -case MGS_CONNECT : rq_opc =MGS_DISCONNECT ;break ; +case OST_CONNECT : + rq_opc =OST_DISCONNECT ; +break ; +case MDS_CONNECT : + rq_opc =MDS_DISCONNECT ; +break ; +case MGS_CONNECT : + rq_opc =MGS_DISCONNECT ; +break ;default : -CERROR ("don't know how to disconnect from %s (connect_op %d)\n" , -obd2cli_tgt (imp->imp_obd), imp->imp_connect_op); -return -EINVAL ; + rc = -EINVAL ; +CERROR ("%s: don't know how to disconnect from %s " +"(connect_op %d): rc = %d\n" , + imp->imp_obd->obd_name,obd2cli_tgt (imp->imp_obd), + imp->imp_connect_op, rc); +return rc; }if (ptlrpc_import_in_recovery (imp)) {struct l_wait_info lwi;cfs_duration_t timeout; -if (AT_OFF ) {if (imp->imp_server_timeout) timeout =cfs_time_seconds (obd_timeout /2 );
@@ -1446,7 +1453,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose)spin_lock (&imp->imp_lock);if (imp->imp_state !=LUSTRE_IMP_FULL )GOTO (out,0 ); -spin_unlock (&imp->imp_lock); req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_DISCONNECT,
@@ -1479,6 +1485,9 @@ out:memset (&imp->imp_remote_handle,0 ,sizeof (imp->imp_remote_handle));spin_unlock (&imp->imp_lock); +if (rc == -ETIMEDOUT || rc == -ENOTCONN || rc == -ESHUTDOWN ) + rc =0 ; +return rc; }EXPORT_SYMBOL (ptlrpc_disconnect_import);
drivers/staging/lustre/lustre/ptlrpc/recover.c +4 -1
@@ -369,11 +369,14 @@ EXPORT_SYMBOL(ptlrpc_recover_import);int ptlrpc_import_in_recovery (struct obd_import *imp) {int in_recovery =1 ; +spin_lock (&imp->imp_lock);if (imp->imp_state ==LUSTRE_IMP_FULL || imp->imp_state ==LUSTRE_IMP_CLOSED || - imp->imp_state ==LUSTRE_IMP_DISCON ) + imp->imp_state ==LUSTRE_IMP_DISCON || + imp->imp_obd->obd_no_recov) in_recovery =0 ;spin_unlock (&imp->imp_lock); +return in_recovery; }
Signature · 1 line
1.8.5.3
PATCH 10/47 staging/lustre/gss: fix few issues found by Klocwork Insight tool
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
Array 'message_buf' of size 500 may use index value(s) -1
Object 'enc_key.data' was freed at line 164 after being freed by calling 'free' at line 150. Also there are 3 similar errors on line(s) 164.
Suspicious dereference of pointer 'vmsg' before NULL check at line 187. Also there are 2 similar errors on line(s) 196, 205.
Suspicious dereference of pointer 'rmsg' before NULL check at line 191. Also there are 2 similar errors on line(s) 200, 209.
Reviewed-on: http://review.whamcloud.com/9274
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
--- drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c +6 -6
@@ -176,31 +176,31 @@ int gss_cli_ctx_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,switch (SPTLRPC_FLVR_SVC (req->rq_flvr.sf_rpc)) {case SPTLRPC_SVC_NULL : vmsg = req->rq_repdata; +LASSERT (vmsg !=NULL && vmsg->lm_bufcount >=3 ); voff = vmsg->lm_bufcount -1 ; -LASSERT (vmsg && vmsg->lm_bufcount >=3 ); rmsg = req->rq_reqbuf; +LASSERT (rmsg !=NULL && rmsg->lm_bufcount >=3 ); roff = rmsg->lm_bufcount -1 ;/* last segment */ -LASSERT (rmsg && rmsg->lm_bufcount >=3 );break ;case SPTLRPC_SVC_AUTH :case SPTLRPC_SVC_INTG : vmsg = req->rq_repdata; +LASSERT (vmsg !=NULL && vmsg->lm_bufcount >=4 ); voff = vmsg->lm_bufcount -2 ; -LASSERT (vmsg && vmsg->lm_bufcount >=4 ); rmsg = req->rq_reqbuf; +LASSERT (rmsg !=NULL && rmsg->lm_bufcount >=4 ); roff = rmsg->lm_bufcount -2 ;/* second last segment */ -LASSERT (rmsg && rmsg->lm_bufcount >=4 );break ;case SPTLRPC_SVC_PRIV : vmsg = req->rq_repdata; +LASSERT (vmsg !=NULL && vmsg->lm_bufcount >=2 ); voff = vmsg->lm_bufcount -1 ; -LASSERT (vmsg && vmsg->lm_bufcount >=2 ); rmsg = req->rq_clrbuf; +LASSERT (rmsg !=NULL && rmsg->lm_bufcount >=2 ); roff = rmsg->lm_bufcount -1 ;/* last segment */ -LASSERT (rmsg && rmsg->lm_bufcount >=2 );break ;default :LBUG ();
Signature · 1 line
1.8.5.3
PATCH 11/47 staging/lustre/ptlrpc: add rpc_cache
In reply to Oleg DrokinFrom: Andriy Skulysh <[email protected]>
Add rpc_cache for allocating ptlrpc_requests.
Xyratex-bug-id: MRP-689
Reviewed-on: http://review.whamcloud.com/6874
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2424
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 42 ++++++++++++++++++---- drivers/staging/lustre/lustre/ptlrpc/events.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 4 +++ .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 32 ++++++++++++----- drivers/staging/lustre/lustre/ptlrpc/sec.c | 10 +++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 13 ++++--- 6 files changed, 75 insertions(+), 28 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +35 -7
@@ -379,6 +379,34 @@ static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req)return rc; } +struct kmem_cache *request_cache; + +int ptlrpc_request_cache_init (void ) +{ + request_cache =kmem_cache_create ("ptlrpc_cache" , +sizeof (struct ptlrpc_request ), +0 ,SLAB_HWCACHE_ALIGN ,NULL ); +return request_cache ==NULL ? -ENOMEM :0 ; +} + +void ptlrpc_request_cache_fini (void ) +{ +kmem_cache_destroy (request_cache); +} + +struct ptlrpc_request *ptlrpc_request_cache_alloc (int flags) +{ +struct ptlrpc_request *req; + +OBD_SLAB_ALLOC_PTR_GFP (req, request_cache, flags); +return req; +} + +void ptlrpc_request_cache_free (struct ptlrpc_request *req) +{ +OBD_SLAB_FREE_PTR (req, request_cache); +} +/** * Wind down request pool \a pool. * Frees all requests from the pool too
@@ -397,7 +425,7 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool)LASSERT (req->rq_reqbuf);LASSERT (req->rq_reqbuf_len == pool->prp_rq_size);OBD_FREE_LARGE (req->rq_reqbuf, pool->prp_rq_size); -OBD_FREE (req,sizeof (*req)); +ptlrpc_request_cache_free (req); }spin_unlock (&pool->prp_lock);OBD_FREE (pool,sizeof (*pool));
@@ -427,12 +455,12 @@ void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq)struct lustre_msg *msg;spin_unlock (&pool->prp_lock); -OBD_ALLOC (req,sizeof (struct ptlrpc_request )); + req =ptlrpc_request_cache_alloc (__GFP_IO);if (!req)return ;OBD_ALLOC_LARGE (msg, size);if (!msg) { -OBD_FREE (req,sizeof (struct ptlrpc_request )); +ptlrpc_request_cache_free (req);return ; } req->rq_reqbuf = msg;
@@ -668,7 +696,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp, request =ptlrpc_prep_req_from_pool (pool);if (!request) -OBD_ALLOC_PTR (request); + request =ptlrpc_request_cache_alloc (__GFP_IO);if (request) {LASSERTF ((unsigned long )imp >0x1000 ,"%p" , imp);
@@ -739,7 +767,7 @@ void ptlrpc_request_free(struct ptlrpc_request *request)if (request->rq_pool)__ptlrpc_free_req_to_pool (request);else -OBD_FREE_PTR (request); +ptlrpc_request_cache_free (request); }EXPORT_SYMBOL (ptlrpc_request_free);
@@ -2233,7 +2261,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)if (request->rq_pool)__ptlrpc_free_req_to_pool (request);else -OBD_FREE (request,sizeof (*request)); +ptlrpc_request_cache_free (request); }static int __ptlrpc_req_finished (struct ptlrpc_request *request,int locked);
@@ -3023,7 +3051,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp,return ERR_PTR (-EINVAL );/* copy some code from deprecated fakereq. */ -OBD_ALLOC_PTR (req); + req =ptlrpc_request_cache_alloc (__GFP_IO);if (req ==NULL ) {CERROR ("ptlrpc: run out of memory!\n" );return ERR_PTR (-ENOMEM );
drivers/staging/lustre/lustre/ptlrpc/events.c +1 -1
@@ -307,7 +307,7 @@ void request_in_callback(lnet_event_t *ev)/* We moaned above already... */ return ; } -OBD_ALLOC_GFP (req,sizeof (*req),ALLOC_ATOMIC_TRY ); + req =ptlrpc_request_cache_alloc (ALLOC_ATOMIC_TRY );if (req ==NULL ) { CERROR("Can't allocate incoming request descriptor: " "Dropping %s RPC from %s\n",
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +4 -0
@@ -55,6 +55,10 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc);/* client.c */ struct ptlrpc_bulk_desc *ptlrpc_new_bulk (unsigned npages,unsigned max_brw,unsigned type,unsigned portal); +int ptlrpc_request_cache_init (void ); +void ptlrpc_request_cache_fini (void ); +struct ptlrpc_request *ptlrpc_request_cache_alloc (int flags); +void ptlrpc_request_cache_free (struct ptlrpc_request *req);void ptlrpc_init_xid (void );/* events.c */
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +24 -8
@@ -73,29 +73,34 @@ __init int ptlrpc_init(void)return rc; cleanup_phase =1 ; + rc =ptlrpc_request_cache_init (); +if (rc) +GOTO (cleanup, rc); + cleanup_phase =2 ; rc =ptlrpc_init_portals ();if (rc)GOTO (cleanup, rc); - cleanup_phase =2 ; + + cleanup_phase =3 ; rc =ptlrpc_connection_init ();if (rc)GOTO (cleanup, rc); - cleanup_phase =3 ; + cleanup_phase =4 ; ptlrpc_put_connection_superhack = ptlrpc_connection_put; rc =ptlrpc_start_pinger ();if (rc)GOTO (cleanup, rc); - cleanup_phase =4 ; + cleanup_phase =5 ; rc =ldlm_init ();if (rc)GOTO (cleanup, rc); - cleanup_phase =5 ; + cleanup_phase =6 ; rc =sptlrpc_init ();if (rc)GOTO (cleanup, rc);
@@ -115,19 +120,29 @@ cleanup:switch (cleanup_phase) {case 8 :ptlrpc_nrs_fini (); +/* Fall through */ case 7 :sptlrpc_fini (); -case 5 : +/* Fall through */ +case 6 :ldlm_exit (); -case 4 : +/* Fall through */ +case 5 :ptlrpc_stop_pinger (); -case 3 : +/* Fall through */ +case 4 :ptlrpc_connection_fini (); -case 2 : +/* Fall through */ +case 3 :ptlrpc_exit_portals (); +/* Fall through */ +case 2 : +ptlrpc_request_cache_fini (); +/* Fall through */ case 1 :ptlrpc_hr_fini ();req_layout_fini (); +/* Fall through */ default : ; }
@@ -142,6 +157,7 @@ static void __exit ptlrpc_exit(void)ldlm_exit ();ptlrpc_stop_pinger ();ptlrpc_exit_portals (); +ptlrpc_request_cache_fini ();ptlrpc_hr_fini ();ptlrpc_connection_fini (); }
drivers/staging/lustre/lustre/ptlrpc/sec.c +5 -5
@@ -916,7 +916,7 @@ int sptlrpc_import_check_ctx(struct obd_import *imp)return -EACCES ; } -OBD_ALLOC_PTR (req); + req =ptlrpc_request_cache_alloc (__GFP_IO);if (!req)return -ENOMEM ;
@@ -932,7 +932,7 @@ int sptlrpc_import_check_ctx(struct obd_import *imp) rc =sptlrpc_req_refresh_ctx (req,0 );LASSERT (list_empty (&req->rq_ctx_chain));sptlrpc_cli_ctx_put (req->rq_cli_ctx,1 ); -OBD_FREE_PTR (req); +ptlrpc_request_cache_free (req);return rc; }
@@ -1100,7 +1100,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,int early_bufsz, early_size;int rc; -OBD_ALLOC_PTR (early_req); + early_req =ptlrpc_request_cache_alloc (__GFP_IO);if (early_req ==NULL )return -ENOMEM ;
@@ -1172,7 +1172,7 @@ err_ctx: err_buf:OBD_FREE_LARGE (early_buf, early_bufsz); err_req: -OBD_FREE_PTR (early_req); +ptlrpc_request_cache_free (early_req);return rc; }
@@ -1189,7 +1189,7 @@ void sptlrpc_cli_finish_early_reply(struct ptlrpc_request *early_req)sptlrpc_cli_ctx_put (early_req->rq_cli_ctx,1 );OBD_FREE_LARGE (early_req->rq_repbuf, early_req->rq_repbuf_len); -OBD_FREE_PTR (early_req); +ptlrpc_request_cache_free (early_req); }/**************************************************
drivers/staging/lustre/lustre/ptlrpc/service.c +6 -7
@@ -842,7 +842,7 @@ static void ptlrpc_server_free_request(struct ptlrpc_request *req)/* NB request buffers use an embedded * req if the incoming req unlinked the * MD; this isn't one of them! */ -OBD_FREE (req,sizeof (*req)); +ptlrpc_request_cache_free (req); } }
@@ -1305,14 +1305,12 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) } newdl =cfs_time_current_sec () +at_get (&svcpt->scp_at_estimate); -OBD_ALLOC (reqcopy,sizeof (*reqcopy)); + reqcopy =ptlrpc_request_cache_alloc (__GFP_IO);if (reqcopy ==NULL )return -ENOMEM ;OBD_ALLOC_LARGE (reqmsg, req->rq_reqlen); -if (!reqmsg) { -OBD_FREE (reqcopy,sizeof (*reqcopy)); -return -ENOMEM ; - } +if (!reqmsg) +GOTO (out_free, rc = -ENOMEM ); *reqcopy = *req; reqcopy->rq_reply_state =NULL ;
@@ -1369,7 +1367,8 @@ out_put: out:sptlrpc_svc_ctx_decref (reqcopy);OBD_FREE_LARGE (reqmsg, req->rq_reqlen); -OBD_FREE (reqcopy,sizeof (*reqcopy)); +out_free: +ptlrpc_request_cache_free (reqcopy);return rc; }
Signature · 1 line
1.8.5.3
Re: [PATCH 11/47] staging/lustre/ptlrpc: add rpc_cache
Quoted 67 lines · Oleg Drokin
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +19
-8@@ -73,29 +73,34 @@ __init int ptlrpc_init(void)return rc; cleanup_phase =1 ; + rc =ptlrpc_request_cache_init (); +if (rc) +GOTO (cleanup, rc); + cleanup_phase =2 ; rc =ptlrpc_init_portals ();if (rc)GOTO (cleanup, rc); - cleanup_phase =2 ; + + cleanup_phase =3 ; rc =ptlrpc_connection_init ();if (rc)GOTO (cleanup, rc); - cleanup_phase =3 ; + cleanup_phase =4 ; ptlrpc_put_connection_superhack = ptlrpc_connection_put; rc =ptlrpc_start_pinger ();if (rc)GOTO (cleanup, rc); - cleanup_phase =4 ; + cleanup_phase =5 ; rc =ldlm_init ();if (rc)GOTO (cleanup, rc); - cleanup_phase =5 ; + cleanup_phase =6 ; rc =sptlrpc_init ();if (rc)GOTO (cleanup, rc);@@ -115,19 +120,29 @@ cleanup:switch (cleanup_phase) {case 8 :ptlrpc_nrs_fini (); +/* Fall through */ case 7 :sptlrpc_fini (); -case 5 : +/* Fall through */ +case 6 :ldlm_exit (); -case 4 : +/* Fall through */ +case 5 :ptlrpc_stop_pinger (); -case 3 : +/* Fall through */ +case 4 :ptlrpc_connection_fini (); -case 2 : +/* Fall through */ +case 3 :ptlrpc_exit_portals (); +/* Fall through */
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c cleanup: · line 148
Quoted 10 lines
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +4
-0+case 2 : +ptlrpc_request_cache_fini (); +/* Fall through */ case 1 :ptlrpc_hr_fini ();req_layout_fini (); +/* Fall through */ default : ; }
Heh. Oh wow. That's horrible. :P
Hopefully next time someone will fix this pile of monkey poo instead just renumbering all the grains of corn.
regards,
dan carpenter
Re: [PATCH 11/47] staging/lustre/ptlrpc: add rpc_cache
Hello!
Quoted 34 lines · Dan Carpenter
Quoted 28 lines
(quoted diff) +1
-0+ /* Fall through */case 7: sptlrpc_fini();drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +2
-1-case 5 : +/* Fall through */ +case 6 :ldlm_exit();drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +2
-1-case 4 : +/* Fall through */ +case 5 :ptlrpc_stop_pinger();drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +2
-1-case 3 : +/* Fall through */ +case 4 :ptlrpc_connection_fini();drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +2
-1-case 2 : +/* Fall through */ +case 3 :ptlrpc_exit_portals();drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +4
-0+/* Fall through */ +case 2 : +ptlrpc_request_cache_fini (); +/* Fall through */ case 1: ptlrpc_hr_fini(); req_layout_fini();(quoted diff) +1
-0+ /* Fall through */Quoted 3 lines
default: ; }Heh. Oh wow. That's horrible. :P
Quoted 2 lines
Hopefully next time someone will fix this pile of monkey poo instead just renumbering all the grains of corn.
Agreed.
We actually have it fixed, but it again came with some other rework that we are probably not ready to merge anywhere yet.
I guess I can extract just this cleanup ahead of time.
Bye,
Oleg
PATCH 12/47 staging/lustre: restore __GFP_WAIT flag to memalloc calls
In reply to Oleg DrokinFrom: Ann Koehler <[email protected]>
In Lustre 2.4, the flags passed to the memory allocation functions are translated from CFS enumeration values types to the kernel GFP values by calling cfs_alloc_flags_to_gfp(). This function adds __GFP_WAIT to all flags except CFS_ALLOC_ATOMIC. In 2.5, when the cfs wrappers were dropped, cfs_alloc_flags_to_gfp() was removed and the CFS_ALLOC_xxxx was simply replaced with __GFP_xxxx. This means that most memory allocation calls are missing the __GFP_WAIT flag. The result is that Lustre experiences more ENOMEM errors, many of which the higher levels of Lustre do not handle robustly.
Notes GFP_NOFS = __GFP_WAIT | __GFP_IO. So the patch replaces __GFP_IO with GFP_NOFS.
Patch does not add __GFP_WAIT to GFP_IOFS. GFP_IOFS was not used in Lustre 2.4 so it has never been used with __GFP_WAIT.
Reviewed-on: http://review.whamcloud.com/9223
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4357
--- .../staging/lustre/include/linux/libcfs/libcfs_private.h | 4 ++-- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- drivers/staging/lustre/lustre/include/obd_class.h | 2 +- drivers/staging/lustre/lustre/include/obd_support.h | 10 +++++----- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 13 ++++++------- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 6 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/super25.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 4 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 2 +- drivers/staging/lustre/lustre/lov/lov_lock.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- drivers/staging/lustre/lustre/obdecho/echo_client.c | 8 ++++---- drivers/staging/lustre/lustre/osc/osc_dev.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 +++--- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- 33 files changed, 57 insertions(+), 58 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +2 -2
@@ -153,7 +153,7 @@ do { \* default allocator */ #define LIBCFS_ALLOC (ptr, size) \ - LIBCFS_ALLOC_GFP(ptr, size, __GFP_IO) + LIBCFS_ALLOC_GFP(ptr, size, GFP_NOFS)/** * non-sleeping allocator
@@ -177,7 +177,7 @@ do { \/** default numa allocator */ #define LIBCFS_CPT_ALLOC (ptr, cptab, cpt, size) \ - LIBCFS_CPT_ALLOC_GFP(ptr, cptab, cpt, size, __GFP_IO) + LIBCFS_CPT_ALLOC_GFP(ptr, cptab, cpt, size, GFP_NOFS)#define LIBCFS_FREE (ptr, size) \ do { \
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
@@ -1141,7 +1141,7 @@ kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages)for (i =0 ; i < npages; i++) { p->ibp_pages[i] =alloc_pages_node (cfs_cpt_spread_node (lnet_cpt_table (), cpt), - __GFP_IO,0 ); +GFP_NOFS ,0 );if (p->ibp_pages[i] ==NULL ) {CERROR ("Can't allocate page %d of %d\n" , i, npages);kiblnd_free_pages (p);
drivers/staging/lustre/lustre/include/obd_class.h +1 -1
@@ -2133,7 +2133,7 @@ extern struct kmem_cache *obdo_cachep;#define OBDO_ALLOC (ptr) \ do { \ - OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, __GFP_IO); \ + OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, GFP_NOFS); \ } while(0)#define OBDO_FREE (ptr) \
drivers/staging/lustre/lustre/include/obd_support.h +5 -5
@@ -641,8 +641,8 @@ do { \#define OBD_ALLOC_GFP (ptr, size, gfp_mask) \ __OBD_MALLOC_VERBOSE(ptr, NULL, 0, size, gfp_mask) -#define OBD_ALLOC (ptr, size) OBD_ALLOC_GFP(ptr, size, __GFP_IO) -#define OBD_ALLOC_WAIT (ptr, size) OBD_ALLOC_GFP(ptr, size, GFP_IOFS) +#define OBD_ALLOC (ptr, size) OBD_ALLOC_GFP(ptr, size, GFP_NOFS) +#define OBD_ALLOC_WAIT (ptr, size) OBD_ALLOC_GFP(ptr, size, GFP_KERNEL)#define OBD_ALLOC_PTR (ptr) OBD_ALLOC(ptr, sizeof(*(ptr)))#define OBD_ALLOC_PTR_WAIT (ptr) OBD_ALLOC_WAIT(ptr, sizeof(*(ptr)))
@@ -650,7 +650,7 @@ do { \ __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, gfp_mask)#define OBD_CPT_ALLOC (ptr, cptab, cpt, size) \ - OBD_CPT_ALLOC_GFP(ptr, cptab, cpt, size, __GFP_IO) + OBD_CPT_ALLOC_GFP(ptr, cptab, cpt, size, GFP_NOFS)#define OBD_CPT_ALLOC_PTR (ptr, cptab, cpt) \ OBD_CPT_ALLOC(ptr, cptab, cpt, sizeof(*(ptr)))
@@ -793,10 +793,10 @@ do { \ } while(0)#define OBD_SLAB_ALLOC (ptr, slab, size) \ - OBD_SLAB_ALLOC_GFP(ptr, slab, size, __GFP_IO) + OBD_SLAB_ALLOC_GFP(ptr, slab, size, GFP_NOFS)#define OBD_SLAB_CPT_ALLOC (ptr, slab, cptab, cpt, size) \ - OBD_SLAB_CPT_ALLOC_GFP(ptr, slab, cptab, cpt, size, __GFP_IO) + OBD_SLAB_CPT_ALLOC_GFP(ptr, slab, cptab, cpt, size, GFP_NOFS)#define OBD_SLAB_ALLOC_PTR (ptr, slab) \ OBD_SLAB_ALLOC(ptr, slab, sizeof(*(ptr)))
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +6 -7
@@ -112,12 +112,11 @@ static struct lu_kmem_descr ccc_caches[] = {* */ -void *ccc_key_init (const struct lu_context *ctx, -struct lu_context_key *key) +void *ccc_key_init (const struct lu_context *ctx,struct lu_context_key *key) {struct ccc_thread_info *info; -OBD_SLAB_ALLOC_PTR_GFP (info, ccc_thread_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, ccc_thread_kmem,GFP_NOFS );if (info ==NULL ) info =ERR_PTR (-ENOMEM );return info;
@@ -135,7 +134,7 @@ void *ccc_session_key_init(const struct lu_context *ctx, {struct ccc_session *session; -OBD_SLAB_ALLOC_PTR_GFP (session, ccc_session_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (session, ccc_session_kmem,GFP_NOFS );if (session ==NULL ) session =ERR_PTR (-ENOMEM );return session;
@@ -251,7 +250,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,struct ccc_req *vrq;int result; -OBD_SLAB_ALLOC_PTR_GFP (vrq, ccc_req_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (vrq, ccc_req_kmem,GFP_NOFS );if (vrq !=NULL ) {cl_req_slice_add (req, &vrq->crq_cl, dev, &ccc_req_ops); result =0 ;
@@ -327,7 +326,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,struct ccc_object *vob;struct lu_object *obj; -OBD_SLAB_ALLOC_PTR_GFP (vob, ccc_object_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (vob, ccc_object_kmem,GFP_NOFS );if (vob !=NULL ) {struct cl_object_header *hdr;
@@ -396,7 +395,7 @@ int ccc_lock_init(const struct lu_env *env,CLOBINVRNT (env, obj,ccc_object_invariant (obj)); -OBD_SLAB_ALLOC_PTR_GFP (clk, ccc_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (clk, ccc_lock_kmem,GFP_NOFS );if (clk !=NULL ) {cl_lock_slice_add (lock, &clk->clk_cl, obj, lkops); result =0 ;
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +1 -1
@@ -104,7 +104,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock)struct ldlm_interval *node;LASSERT (lock->l_resource->lr_type ==LDLM_EXTENT ); -OBD_SLAB_ALLOC_PTR_GFP (node, ldlm_interval_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (node, ldlm_interval_slab,GFP_NOFS );if (node ==NULL )return NULL ;
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +3 -3
@@ -437,7 +437,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource)if (resource ==NULL )LBUG (); -OBD_SLAB_ALLOC_PTR_GFP (lock, ldlm_lock_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lock, ldlm_lock_slab,GFP_NOFS );if (lock ==NULL )return NULL ;
@@ -1624,7 +1624,7 @@ ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *ns,* have to allocate the interval node early otherwise we can't regrant * this lock in the future. - jay */ if (!local && (*flags &LDLM_FL_REPLAY ) && res->lr_type ==LDLM_EXTENT ) -OBD_SLAB_ALLOC_PTR_GFP (node, ldlm_interval_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (node, ldlm_interval_slab,GFP_NOFS );lock_res_and_lock (lock);if (local && lock->l_req_mode == lock->l_granted_mode) {
@@ -2146,7 +2146,7 @@ struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,/* I can't check the type of lock here because the bitlock of lock * is not held here, so do the allocation blindly. -jay */ -OBD_SLAB_ALLOC_PTR_GFP (node, ldlm_interval_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (node, ldlm_interval_slab,GFP_NOFS );if (node ==NULL )/* Actually, this causes EDEADLOCK to be returned */ return NULL ;
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +1 -1
@@ -1014,7 +1014,7 @@ static struct ldlm_resource *ldlm_resource_new(void)struct ldlm_resource *res;int idx; -OBD_SLAB_ALLOC_PTR_GFP (res, ldlm_resource_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (res, ldlm_resource_slab,GFP_NOFS );if (res ==NULL )return NULL ;
drivers/staging/lustre/lustre/llite/file.c +1 -1
@@ -54,7 +54,7 @@ struct ll_file_data *ll_file_data_get(void) {struct ll_file_data *fd; -OBD_SLAB_ALLOC_PTR_GFP (fd, ll_file_data_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (fd, ll_file_data_slab,GFP_NOFS );if (fd ==NULL )return NULL ; fd->fd_write_failed = false;
drivers/staging/lustre/lustre/llite/super25.c +1 -1
@@ -52,7 +52,7 @@ static struct inode *ll_alloc_inode(struct super_block *sb) {struct ll_inode_info *lli;ll_stats_ops_tally (ll_s2sbi (sb),LPROC_LL_ALLOC_INODE ,1 ); -OBD_SLAB_ALLOC_PTR_GFP (lli, ll_inode_cachep, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lli, ll_inode_cachep,GFP_NOFS );if (lli ==NULL )return NULL ;
drivers/staging/lustre/lustre/llite/vvp_dev.c +2 -2
@@ -80,7 +80,7 @@ static void *vvp_key_init(const struct lu_context *ctx, {struct vvp_thread_info *info; -OBD_SLAB_ALLOC_PTR_GFP (info, vvp_thread_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, vvp_thread_kmem,GFP_NOFS );if (info ==NULL ) info =ERR_PTR (-ENOMEM );return info;
@@ -98,7 +98,7 @@ static void *vvp_session_key_init(const struct lu_context *ctx, {struct vvp_session *session; -OBD_SLAB_ALLOC_PTR_GFP (session, vvp_session_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (session, vvp_session_kmem,GFP_NOFS );if (session ==NULL ) session =ERR_PTR (-ENOMEM );return session;
drivers/staging/lustre/lustre/llite/xattr_cache.c +1 -1
@@ -120,7 +120,7 @@ static int ll_xattr_cache_add(struct list_head *cache,return -EPROTO ; } -OBD_SLAB_ALLOC_PTR_GFP (xattr, xattr_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (xattr, xattr_kmem,GFP_NOFS );if (xattr ==NULL ) {CDEBUG (D_CACHE ,"failed to allocate xattr\n" );return -ENOMEM ;
drivers/staging/lustre/lustre/lov/lov_dev.c +3 -3
@@ -143,7 +143,7 @@ static void *lov_key_init(const struct lu_context *ctx, {struct lov_thread_info *info; -OBD_SLAB_ALLOC_PTR_GFP (info, lov_thread_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, lov_thread_kmem,GFP_NOFS );if (info !=NULL )INIT_LIST_HEAD (&info->lti_closure.clc_list);else
@@ -170,7 +170,7 @@ static void *lov_session_key_init(const struct lu_context *ctx, {struct lov_session *info; -OBD_SLAB_ALLOC_PTR_GFP (info, lov_session_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, lov_session_kmem,GFP_NOFS );if (info ==NULL ) info =ERR_PTR (-ENOMEM );return info;
@@ -260,7 +260,7 @@ static int lov_req_init(const struct lu_env *env, struct cl_device *dev,struct lov_req *lr;int result; -OBD_SLAB_ALLOC_PTR_GFP (lr, lov_req_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lr, lov_req_kmem,GFP_NOFS );if (lr !=NULL ) {cl_req_slice_add (req, &lr->lr_cl, dev, &lov_req_ops); result =0 ;
drivers/staging/lustre/lustre/lov/lov_ea.c +1 -1
@@ -101,7 +101,7 @@ struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size)return NULL ;for (i =0 ; i < stripe_count; i++) { -OBD_SLAB_ALLOC_PTR_GFP (loi, lov_oinfo_slab, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (loi, lov_oinfo_slab,GFP_NOFS );if (loi ==NULL ) goto err; lsm->lsm_oinfo[i] = loi;
drivers/staging/lustre/lustre/lov/lov_lock.c +3 -3
@@ -144,7 +144,7 @@ static struct cl_lock *lov_sublock_alloc(const struct lu_env *env,LASSERT (idx < lck->lls_nr); -OBD_SLAB_ALLOC_PTR_GFP (link, lov_lock_link_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (link, lov_lock_link_kmem,GFP_NOFS );if (link !=NULL ) {struct lov_sublock_env *subenv;struct lov_lock_sub *lls;
@@ -1159,7 +1159,7 @@ int lov_lock_init_raid0(const struct lu_env *env, struct cl_object *obj,struct lov_lock *lck;int result; -OBD_SLAB_ALLOC_PTR_GFP (lck, lov_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lck, lov_lock_kmem,GFP_NOFS );if (lck !=NULL ) {cl_lock_slice_add (lock, &lck->lls_cl, obj, &lov_lock_ops); result =lov_lock_sub_init (env, lck, io);
@@ -1194,7 +1194,7 @@ int lov_lock_init_empty(const struct lu_env *env, struct cl_object *obj,struct lov_lock *lck;int result = -ENOMEM ; -OBD_SLAB_ALLOC_PTR_GFP (lck, lov_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lck, lov_lock_kmem,GFP_NOFS );if (lck !=NULL ) {cl_lock_slice_add (lock, &lck->lls_cl, obj, &lov_empty_lock_ops); lck->lls_orig = lock->cll_descr;
drivers/staging/lustre/lustre/lov/lov_object.c +1 -1
@@ -885,7 +885,7 @@ struct lu_object *lov_object_alloc(const struct lu_env *env,struct lov_object *lov;struct lu_object *obj; -OBD_SLAB_ALLOC_PTR_GFP (lov, lov_object_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lov, lov_object_kmem,GFP_NOFS );if (lov !=NULL ) { obj =lov2lu (lov);lu_object_init (obj,NULL , dev);
drivers/staging/lustre/lustre/lov/lovsub_dev.c +1 -1
@@ -146,7 +146,7 @@ static int lovsub_req_init(const struct lu_env *env, struct cl_device *dev,struct lovsub_req *lsr;int result; -OBD_SLAB_ALLOC_PTR_GFP (lsr, lovsub_req_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lsr, lovsub_req_kmem,GFP_NOFS );if (lsr !=NULL ) {cl_req_slice_add (req, &lsr->lsrq_cl, dev, &lovsub_req_ops); result =0 ;
drivers/staging/lustre/lustre/lov/lovsub_lock.c +1 -1
@@ -453,7 +453,7 @@ int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj,struct lovsub_lock *lsk;int result; -OBD_SLAB_ALLOC_PTR_GFP (lsk, lovsub_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lsk, lovsub_lock_kmem,GFP_NOFS );if (lsk !=NULL ) {INIT_LIST_HEAD (&lsk->lss_parents);cl_lock_slice_add (lock, &lsk->lss_cl, obj, &lovsub_lock_ops);
drivers/staging/lustre/lustre/lov/lovsub_object.c +1 -1
@@ -145,7 +145,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,struct lovsub_object *los;struct lu_object *obj; -OBD_SLAB_ALLOC_PTR_GFP (los, lovsub_object_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (los, lovsub_object_kmem,GFP_NOFS );if (los !=NULL ) {struct cl_object_header *hdr;
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
@@ -360,7 +360,7 @@ static struct cl_lock *cl_lock_alloc(const struct lu_env *env,struct cl_lock *lock;struct lu_object_header *head; -OBD_SLAB_ALLOC_PTR_GFP (lock, cl_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (lock, cl_lock_kmem,GFP_NOFS );if (lock !=NULL ) {atomic_set (&lock->cll_ref,1 ); lock->cll_descr = *descr;
drivers/staging/lustre/lustre/obdclass/cl_object.c +1 -1
@@ -684,7 +684,7 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug)struct lu_env *env;struct cl_env *cle; -OBD_SLAB_ALLOC_PTR_GFP (cle, cl_env_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (cle, cl_env_kmem,GFP_NOFS );if (cle !=NULL ) {int rc;
drivers/staging/lustre/lustre/obdclass/cl_page.c +1 -1
@@ -292,7 +292,7 @@ static struct cl_page *cl_page_alloc(const struct lu_env *env,struct lu_object_header *head;OBD_ALLOC_GFP (page,cl_object_header (o)->coh_page_bufsize, - __GFP_IO); +GFP_NOFS );if (page !=NULL ) {int result =0 ;atomic_set (&page->cp_ref,1 );
drivers/staging/lustre/lustre/obdclass/genops.c +1 -1
@@ -72,7 +72,7 @@ static struct obd_device *obd_device_alloc(void) {struct obd_device *obd; -OBD_SLAB_ALLOC_PTR_GFP (obd, obd_device_cachep, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (obd, obd_device_cachep,GFP_NOFS );if (obd !=NULL ) { obd->obd_magic =OBD_DEVICE_MAGIC ; }
drivers/staging/lustre/lustre/obdecho/echo_client.c +4 -4
@@ -428,7 +428,7 @@ static int echo_lock_init(const struct lu_env *env, {struct echo_lock *el; -OBD_SLAB_ALLOC_PTR_GFP (el, echo_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (el, echo_lock_kmem,GFP_NOFS );if (el !=NULL ) {cl_lock_slice_add (lock, &el->el_cl, obj, &echo_lock_ops); el->el_object =cl2echo_obj (obj);
@@ -599,7 +599,7 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env,/* we're the top dev. */ LASSERT (hdr ==NULL ); -OBD_SLAB_ALLOC_PTR_GFP (eco, echo_object_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (eco, echo_object_kmem,GFP_NOFS );if (eco !=NULL ) {struct cl_object_header *hdr = &eco->eo_hdr;
@@ -663,7 +663,7 @@ static void *echo_thread_key_init(const struct lu_context *ctx, {struct echo_thread_info *info; -OBD_SLAB_ALLOC_PTR_GFP (info, echo_thread_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, echo_thread_kmem,GFP_NOFS );if (info ==NULL ) info =ERR_PTR (-ENOMEM );return info;
@@ -693,7 +693,7 @@ static void *echo_session_key_init(const struct lu_context *ctx, {struct echo_session_info *session; -OBD_SLAB_ALLOC_PTR_GFP (session, echo_session_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (session, echo_session_kmem,GFP_NOFS );if (session ==NULL ) session =ERR_PTR (-ENOMEM );return session;
drivers/staging/lustre/lustre/osc/osc_dev.c +2 -2
@@ -122,7 +122,7 @@ static void *osc_key_init(const struct lu_context *ctx, {struct osc_thread_info *info; -OBD_SLAB_ALLOC_PTR_GFP (info, osc_thread_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, osc_thread_kmem,GFP_NOFS );if (info ==NULL ) info =ERR_PTR (-ENOMEM );return info;
@@ -146,7 +146,7 @@ static void *osc_session_init(const struct lu_context *ctx, {struct osc_session *info; -OBD_SLAB_ALLOC_PTR_GFP (info, osc_session_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (info, osc_session_kmem,GFP_NOFS );if (info ==NULL ) info =ERR_PTR (-ENOMEM );return info;
drivers/staging/lustre/lustre/osc/osc_io.c +1 -1
@@ -812,7 +812,7 @@ int osc_req_init(const struct lu_env *env, struct cl_device *dev,struct osc_req *or;int result; -OBD_SLAB_ALLOC_PTR_GFP (or, osc_req_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (or, osc_req_kmem,GFP_NOFS );if (or !=NULL ) {cl_req_slice_add (req, &or->or_cl, dev, &osc_req_ops); result =0 ;
drivers/staging/lustre/lustre/osc/osc_lock.c +1 -1
@@ -1559,7 +1559,7 @@ int osc_lock_init(const struct lu_env *env,struct osc_lock *clk;int result; -OBD_SLAB_ALLOC_PTR_GFP (clk, osc_lock_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (clk, osc_lock_kmem,GFP_NOFS );if (clk !=NULL ) {__u32 enqflags = lock->cll_descr.cld_enq_flags;
drivers/staging/lustre/lustre/osc/osc_object.c +1 -1
@@ -260,7 +260,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env,struct osc_object *osc;struct lu_object *obj; -OBD_SLAB_ALLOC_PTR_GFP (osc, osc_object_kmem, __GFP_IO); +OBD_SLAB_ALLOC_PTR_GFP (osc, osc_object_kmem,GFP_NOFS );if (osc !=NULL ) { obj =osc2lu (osc);lu_object_init (obj,NULL , dev);
drivers/staging/lustre/lustre/ptlrpc/client.c +3 -3
@@ -455,7 +455,7 @@ void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq)struct lustre_msg *msg;spin_unlock (&pool->prp_lock); - req =ptlrpc_request_cache_alloc (__GFP_IO); + req =ptlrpc_request_cache_alloc (GFP_NOFS );if (!req)return ;OBD_ALLOC_LARGE (msg, size);
@@ -696,7 +696,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp, request =ptlrpc_prep_req_from_pool (pool);if (!request) - request =ptlrpc_request_cache_alloc (__GFP_IO); + request =ptlrpc_request_cache_alloc (GFP_NOFS );if (request) {LASSERTF ((unsigned long )imp >0x1000 ,"%p" , imp);
@@ -3051,7 +3051,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp,return ERR_PTR (-EINVAL );/* copy some code from deprecated fakereq. */ - req =ptlrpc_request_cache_alloc (__GFP_IO); + req =ptlrpc_request_cache_alloc (GFP_NOFS );if (req ==NULL ) {CERROR ("ptlrpc: run out of memory!\n" );return ERR_PTR (-ENOMEM );
drivers/staging/lustre/lustre/ptlrpc/nrs.c +1 -1
@@ -746,7 +746,7 @@ static int nrs_policy_register(struct ptlrpc_nrs *nrs,LASSERT (desc->pd_compat !=NULL );OBD_CPT_ALLOC_GFP (policy, svcpt->scp_service->srv_cptable, - svcpt->scp_cpt,sizeof (*policy), __GFP_IO); + svcpt->scp_cpt,sizeof (*policy),GFP_NOFS );if (policy ==NULL )return -ENOMEM ;
drivers/staging/lustre/lustre/ptlrpc/sec.c +2 -2
@@ -916,7 +916,7 @@ int sptlrpc_import_check_ctx(struct obd_import *imp)return -EACCES ; } - req =ptlrpc_request_cache_alloc (__GFP_IO); + req =ptlrpc_request_cache_alloc (GFP_NOFS );if (!req)return -ENOMEM ;
@@ -1100,7 +1100,7 @@ int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req,int early_bufsz, early_size;int rc; - early_req =ptlrpc_request_cache_alloc (__GFP_IO); + early_req =ptlrpc_request_cache_alloc (GFP_NOFS );if (early_req ==NULL )return -ENOMEM ;
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
@@ -421,7 +421,7 @@ static int enc_pools_add_pages(int npages) goto out_pools;for (j =0 ; j <PAGES_PER_POOL && alloced < npages; j++) { - pools[i][j] =alloc_page (__GFP_IO | + pools[i][j] =alloc_page (GFP_NOFS | __GFP_HIGHMEM);if (pools[i][j] ==NULL ) goto out_pools;
drivers/staging/lustre/lustre/ptlrpc/service.c +1 -1
@@ -1305,7 +1305,7 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) } newdl =cfs_time_current_sec () +at_get (&svcpt->scp_at_estimate); - reqcopy =ptlrpc_request_cache_alloc (__GFP_IO); + reqcopy =ptlrpc_request_cache_alloc (GFP_NOFS );if (reqcopy ==NULL )return -ENOMEM ;OBD_ALLOC_LARGE (reqmsg, req->rq_reqlen);
Signature · 1 line
1.8.5.3
PATCH 13/47 staging/lustre/gss: fix uninitialized variable
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
'sg->page_link' is used uninitialized in many functions.
Reviewed-on: http://review.whamcloud.com/9325
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
--- drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c +1 -0
@@ -525,6 +525,7 @@ void gss_delete_sec_context_kerberos(void *internal_ctx)static void buf_to_sg (struct scatterlist *sg,void *ptr,int len) { +sg_init_table (sg,1 );sg_set_buf (sg, ptr, len); }
Signature · 1 line
1.8.5.3
PATCH 14/47 staging/lustre: quiet console permission error messages
In reply to Oleg DrokinFrom: Andreas Dilger <[email protected]>
Quiet some common console error messages for permission errors that can be hit in common cases.
Reviewed-on: http://review.whamcloud.com/8988
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4522
--- drivers/staging/lustre/lustre/llite/file.c | 7 ++++--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +4 -3
@@ -2882,9 +2882,10 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc)if (!S_ISREG (inode->i_mode) && !S_ISDIR (inode->i_mode))return 0 ; }else if (rc !=0 ) { -CERROR ("%s: revalidate FID " DFID " error: rc = %d\n" , -ll_get_fsname (inode->i_sb,NULL ,0 ), -PFID (ll_inode2fid (inode)), rc); +CDEBUG_LIMIT ((rc == -EACCES || rc == -EIDRM ) ?D_INFO :D_ERROR , +"%s: revalidate FID " DFID " error: rc = %d\n" , +ll_get_fsname (inode->i_sb,NULL ,0 ), +PFID (ll_inode2fid (inode)), rc); }return rc;
drivers/staging/lustre/lustre/mdc/mdc_locks.c +4 -1
@@ -893,7 +893,10 @@ resend:mdc_put_rpc_lock (obddev->u.cli.cl_rpc_lock, it);if (rc <0 ) { -CERROR ("ldlm_cli_enqueue: %d\n" , rc); +CDEBUG_LIMIT ((rc == -EACCES || rc == -EIDRM ) ?D_INFO :D_ERROR , +"%s: ldlm_cli_enqueue failed: rc = %d\n" , + obddev->obd_name, rc); +mdc_clear_replay_flag (req, rc);ptlrpc_req_finished (req);return rc;
Signature · 1 line
1.8.5.3
PATCH 15/47 staging/lustre/lov: remove unused lov llog code
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
Remove the unused functions lov_llog_init(), lov_llog_finish(), their supporting functions, and the file lov_log.c.
Reviewed-on: http://review.whamcloud.com/8539
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
--- drivers/staging/lustre/lustre/lov/Makefile | 2 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 4 - drivers/staging/lustre/lustre/lov/lov_log.c | 272 ----------------------- drivers/staging/lustre/lustre/lov/lov_obd.c | 9 +- 4 files changed, 3 insertions(+), 284 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/lov/lov_log.c
drivers/staging/lustre/lustre/lov/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_LUSTRE_FS) += lov.o -lov-y := lov_log.o lov_obd.o lov_pack.o lov_offset.o lov_merge.o \ +lov-y := lov_obd.o lov_pack.o lov_offset.o lov_merge.o \ lov_request.o lov_ea.o lov_dev.o lov_object.o lov_page.o \ lov_lock.o lov_io.o lovsub_dev.o lovsub_object.o lovsub_page.o \ lovsub_lock.o lovsub_io.o lov_pool.o
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -4
@@ -251,10 +251,6 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, __u32 *indexp, int *genp);int lov_del_target (struct obd_device *obd,__u32 index,struct obd_uuid *uuidp,int gen); -/* lov_log.c */ -int lov_llog_init (struct obd_device *obd,struct obd_llog_group *olg, -struct obd_device *tgt,int *idx); -int lov_llog_finish (struct obd_device *obd,int count);/* lov_pack.c */ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm,
drivers/staging/lustre/lustre/lov/lov_log.c deleted +0 -272
272 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_obd.c +2 -7
@@ -59,7 +59,6 @@#include <cl_object.h> #include <lclient.h> /* for cl_client_lru */ #include <lustre/ll_fiemap.h> -#include <lustre_log.h> #include <lustre_fid.h> #include "lov_internal.h"
@@ -861,12 +860,10 @@ static int lov_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) }break ; } -case OBD_CLEANUP_EXPORTS : - rc =obd_llog_finish (obd,0 ); -if (rc !=0 ) -CERROR ("failed to cleanup llogging subsystems\n" ); +default :break ; } +return rc; }
@@ -2808,8 +2805,6 @@ struct obd_ops lov_obd_ops = { .o_get_info = lov_get_info, .o_set_info_async = lov_set_info_async, .o_extent_calc = lov_extent_calc, - .o_llog_init = lov_llog_init, - .o_llog_finish = lov_llog_finish, .o_notify = lov_notify, .o_pool_new = lov_pool_new, .o_pool_rem = lov_pool_remove,
Signature · 1 line
1.8.5.3
PATCH 16/47 staging/lustre/obdclass: remove uses of lov_stripe_md
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
Remove the unused function llog_obd_add(). Remove the unused count and parameters from llog_cancel(). Move dump_lsm() from obdclass to the only module that uses it (lov). Remove obd_lov.h.
Reviewed-on: http://review.whamcloud.com/8545
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
--- .../lustre/lustre/include/lustre/lustre_idl.h | 26 +++++ .../staging/lustre/lustre/include/lustre_debug.h | 1 - drivers/staging/lustre/lustre/include/lustre_log.h | 10 -- drivers/staging/lustre/lustre/include/obd.h | 7 ++ drivers/staging/lustre/lustre/include/obd_class.h | 9 -- drivers/staging/lustre/lustre/include/obd_lov.h | 116 --------------------- drivers/staging/lustre/lustre/lov/lov_ea.c | 12 ++- drivers/staging/lustre/lustre/lov/lov_internal.h | 33 +++++- drivers/staging/lustre/lustre/lov/lov_merge.c | 2 - drivers/staging/lustre/lustre/lov/lov_obd.c | 9 +- drivers/staging/lustre/lustre/lov/lov_object.c | 1 - drivers/staging/lustre/lustre/lov/lov_offset.c | 1 - drivers/staging/lustre/lustre/lov/lov_pack.c | 10 +- drivers/staging/lustre/lustre/lov/lov_request.c | 1 - drivers/staging/lustre/lustre/obdclass/debug.c | 12 --- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 29 +----- .../staging/lustre/lustre/obdecho/echo_client.c | 1 - drivers/staging/lustre/lustre/osc/osc_request.c | 1 - drivers/staging/lustre/lustre/ptlrpc/recover.c | 1 - 19 files changed, 85 insertions(+), 197 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/obd_lov.h
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +26 -0
@@ -1682,6 +1682,30 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) stripes * sizeof(struct lov_ost_data_v1); } +static inline __u32 +lov_mds_md_max_stripe_count (size_t buf_size,__u32 lmm_magic) +{ +switch (lmm_magic) { +case LOV_MAGIC_V1 : { +struct lov_mds_md_v1 lmm; + +if (buf_size <sizeof (lmm)) +return 0 ; + +return (buf_size -sizeof (lmm)) /sizeof (lmm.lmm_objects[0 ]); + } +case LOV_MAGIC_V3 : { +struct lov_mds_md_v3 lmm; + +if (buf_size <sizeof (lmm)) +return 0 ; + +return (buf_size -sizeof (lmm)) /sizeof (lmm.lmm_objects[0 ]); + } +default : +return 0 ; + } +}#define OBD_MD_FLID (0x00000001ULL)/* object ID */ #define OBD_MD_FLATIME (0x00000002ULL)/* access time */
@@ -2681,6 +2705,8 @@ enum seq_op {* protocol, this will limit the max number of OSTs per LOV */ #define LOV_DESC_MAGIC 0xB0CCDE5C +#define LOV_DESC_QOS_MAXAGE_DEFAULT 5/* Seconds */ +#define LOV_DESC_STRIPE_SIZE_DEFAULT (1 << LNET_MTU_BITS)/* LOV settings descriptor (should only contain static info) */ struct lov_desc {
drivers/staging/lustre/lustre/include/lustre_debug.h +0 -1
@@ -48,7 +48,6 @@/* lib/debug.c */ void dump_lniobuf (struct niobuf_local *lnb);int dump_req (struct ptlrpc_request *req); -void dump_lsm (int level,struct lov_stripe_md *lsm);int block_debug_setup (void *addr,int len,__u64 off,__u64 id);int block_debug_check (char *who,void *addr,int len,__u64 off,__u64 id);
drivers/staging/lustre/lustre/include/lustre_log.h +0 -10
@@ -206,11 +206,7 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,int __llog_ctxt_put (const struct lu_env *env,struct llog_ctxt *ctxt);int llog_cleanup (const struct lu_env *env,struct llog_ctxt *);int llog_sync (struct llog_ctxt *ctxt,struct obd_export *exp,int flags); -int llog_obd_add (const struct lu_env *env,struct llog_ctxt *ctxt, -struct llog_rec_hdr *rec,struct lov_stripe_md *lsm, -struct llog_cookie *logcookies,int numcookies);int llog_cancel (const struct lu_env *env,struct llog_ctxt *ctxt, -struct lov_stripe_md *lsm,int count,struct llog_cookie *cookies,int flags); int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
@@ -242,7 +238,6 @@ struct llog_operations { int flags);int (*lop_cleanup)(const struct lu_env *env,struct llog_ctxt *ctxt);int (*lop_cancel)(const struct lu_env *env,struct llog_ctxt *ctxt, -struct lov_stripe_md *lsm,int count,struct llog_cookie *cookies,int flags);int (*lop_connect)(struct llog_ctxt *ctxt,struct llog_logid *logid,struct llog_gen *gen,struct obd_uuid *uuid);
@@ -296,11 +291,6 @@ struct llog_operations {int (*lop_add)(const struct lu_env *env,struct llog_handle *lgh,struct llog_rec_hdr *rec,struct llog_cookie *cookie,void *buf,struct thandle *th); -/* Old llog_add version, used in MDS-LOV-OSC now and will gone with -* LOD/OSP replacement */ -int (*lop_obd_add)(const struct lu_env *env,struct llog_ctxt *ctxt, -struct llog_rec_hdr *rec,struct lov_stripe_md *lsm, -struct llog_cookie *logcookies,int numcookies); };/* In-memory descriptor for a log object or log catalog */
drivers/staging/lustre/lustre/include/obd.h +7 -0
@@ -132,6 +132,13 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm)return true; } +static inline int lov_stripe_md_size (unsigned int stripe_count) +{ +struct lov_stripe_md lsm; + +return sizeof (lsm) + stripe_count *sizeof (lsm.lsm_oinfo[0 ]); +} +struct obd_info ;typedef int (*obd_enqueue_update_f )(void *cookie,int rc);
drivers/staging/lustre/lustre/include/obd_class.h +0 -9
@@ -711,15 +711,6 @@ static inline int obd_size_diskmd(struct obd_export *exp,return obd_packmd (exp,NULL , mem_src); } -/* helper functions */ -static inline int obd_alloc_diskmd (struct obd_export *exp, -struct lov_mds_md **disk_tgt) -{ -LASSERT (disk_tgt); -LASSERT (*disk_tgt ==NULL ); -return obd_packmd (exp, disk_tgt,NULL ); -} -static inline int obd_free_diskmd (struct obd_export *exp,struct lov_mds_md **disk_tgt) {
drivers/staging/lustre/lustre/include/obd_lov.h deleted +0 -116
116 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_ea.c +11 -1
@@ -44,7 +44,6 @@#include <linux/libcfs/libcfs.h> #include <obd_class.h> -#include <obd_lov.h> #include <lustre/lustre_idl.h> #include "lov_internal.h"
@@ -346,3 +345,14 @@ const struct lsm_operations lsm_v3_ops = { .lsm_lmm_verify = lsm_lmm_verify_v3, .lsm_unpackmd = lsm_unpackmd_v3, }; + +void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm) +{ +CDEBUG (level,"lsm %p, objid " DOSTID ", maxbytes " LPX64 ", magic 0x%08X," +" stripe_size %u, stripe_count %u, refc: %d," +" layout_gen %u, pool [" LOV_POOLNAMEF "]\n" , lsm, +POSTID (&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, + lsm->lsm_stripe_size, lsm->lsm_stripe_count, +atomic_read (&lsm->lsm_refc), lsm->lsm_layout_gen, + lsm->lsm_pool_name); +}
drivers/staging/lustre/lustre/lov/lov_internal.h +32 -1
@@ -38,9 +38,39 @@#define LOV_INTERNAL_H #include <obd_class.h> -#include <obd_lov.h> #include <lustre/lustre_user.h> +/* lov_do_div64(a, b) returns a % b, and a = a / b. +* The 32-bit code is LOV-specific due to knowing about stripe limits in +* order to reduce the divisor to a 32-bit number. If the divisor is +* already a 32-bit value the compiler handles this directly. */ +#if BITS_PER_LONG ==64 +# define lov_do_div64 (n, base) ({ \ + uint64_t __base = (base); \ + uint64_t __rem; \ + __rem = ((uint64_t)(n)) % __base; \ + (n) = ((uint64_t)(n)) / __base; \ + __rem; \ +}) +#elif BITS_PER_LONG ==32 +# define lov_do_div64 (n, base) ({ \ + uint64_t __rem; \ + if ((sizeof(base) > 4) && (((base) & 0xffffffff00000000ULL) != 0)) { \ + int __remainder; \ + LASSERTF(!((base) & (LOV_MIN_STRIPE_SIZE - 1)), "64 bit lov " \ + "division %llu / %llu\n", (n), (uint64_t)(base)); \ + __remainder = (n) & (LOV_MIN_STRIPE_SIZE - 1); \ + (n) >>= LOV_MIN_STRIPE_BITS; \ + __rem = do_div(n, (base) >> LOV_MIN_STRIPE_BITS); \ + __rem <<= LOV_MIN_STRIPE_BITS; \ + __rem += __remainder; \ + } else { \ + __rem = do_div(n, base); \ + } \ + __rem; \ +}) +#endif +struct lov_lock_handles {struct portals_handle llh_handle;atomic_t llh_refcount;
@@ -275,6 +305,7 @@ void lov_dump_lmm(int level, void *lmm);/* lov_ea.c */ struct lov_stripe_md *lsm_alloc_plain (__u16 stripe_count,int *size);void lsm_free_plain (struct lov_stripe_md *lsm); +void dump_lsm (unsigned int level,const struct lov_stripe_md *lsm);int lovea_destroy_object (struct lov_obd *lov,struct lov_stripe_md *lsm,struct obdo *oa,void *data);
drivers/staging/lustre/lustre/lov/lov_merge.c +0 -2
@@ -39,8 +39,6 @@#include <linux/libcfs/libcfs.h> #include <obd_class.h> -#include <obd_lov.h> -#include "lov_internal.h" /** Merge the lock value block(&lvb) attributes and KMS from each of the
drivers/staging/lustre/lustre/lov/lov_obd.c +3 -6
@@ -50,9 +50,7 @@#include <lustre/lustre_idl.h> #include <lustre_dlm.h> #include <lustre_mds.h> -#include <lustre_debug.h> #include <obd_class.h> -#include <obd_lov.h> #include <obd_ost.h> #include <lprocfs_status.h> #include <lustre_param.h>
@@ -725,8 +723,8 @@ void lov_fix_desc_stripe_size(__u64 *val)if (*val !=0 )LCONSOLE_INFO ("Increasing default stripe size to " "minimum %u\n" , -LOV_DEFAULT_STRIPE_SIZE ); - *val =LOV_DEFAULT_STRIPE_SIZE ; +LOV_DESC_STRIPE_SIZE_DEFAULT ); + *val =LOV_DESC_STRIPE_SIZE_DEFAULT ; }else if (*val & (LOV_MIN_STRIPE_SIZE -1 )) { *val &= ~(LOV_MIN_STRIPE_SIZE -1 ); LCONSOLE_WARN("Changing default stripe size to "LPU64" (a "
@@ -752,9 +750,8 @@ void lov_fix_desc_pattern(__u32 *val)void lov_fix_desc_qos_maxage (__u32 *val) { -/* fix qos_maxage */ if (*val ==0 ) - *val =QOS_DEFAULT_MAXAGE ; + *val =LOV_DESC_QOS_MAXAGE_DEFAULT ; }void lov_fix_desc (struct lov_desc *desc)
drivers/staging/lustre/lustre/lov/lov_object.c +0 -1
@@ -42,7 +42,6 @@#define DEBUG_SUBSYSTEM S_LOV#include "lov_cl_internal.h" -#include <lustre_debug.h> /** \addtogroup lov * @{
drivers/staging/lustre/lustre/lov/lov_offset.c +0 -1
@@ -39,7 +39,6 @@#include <linux/libcfs/libcfs.h> #include <obd_class.h> -#include <obd_lov.h> #include "lov_internal.h"
drivers/staging/lustre/lustre/lov/lov_pack.c +5 -5
@@ -44,7 +44,6 @@#include <lustre_net.h> #include <obd.h> -#include <obd_lov.h> #include <obd_class.h> #include <obd_support.h> #include <lustre/lustre_user.h>
@@ -177,8 +176,9 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,* Anyway, this is pretty inaccurate since ld_tgt_count now * represents max index and we should rely on the actual number * of OSTs instead */ - stripe_count =lov_mds_md_stripecnt (lov->lov_ocd.ocd_max_easize, - lmm_magic); + stripe_count =lov_mds_md_max_stripe_count ( + lov->lov_ocd.ocd_max_easize, lmm_magic); +if (stripe_count > lov->desc.ld_tgt_count) stripe_count = lov->desc.ld_tgt_count; }
@@ -264,8 +264,8 @@ __u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count)* larger EA sizes */ if (lov->lov_ocd.ocd_connect_flags &OBD_CONNECT_MAX_EASIZE && lov->lov_ocd.ocd_max_easize) - max_stripes =lov_mds_md_stripecnt (lov->lov_ocd.ocd_max_easize, - magic); + max_stripes =lov_mds_md_max_stripe_count ( + lov->lov_ocd.ocd_max_easize, magic);if (stripe_count > max_stripes) stripe_count = max_stripes;
drivers/staging/lustre/lustre/lov/lov_request.c +0 -1
@@ -39,7 +39,6 @@#include <linux/libcfs/libcfs.h> #include <obd_class.h> -#include <obd_lov.h> #include <lustre/lustre_idl.h> #include "lov_internal.h"
drivers/staging/lustre/lustre/obdclass/debug.c +0 -12
@@ -56,18 +56,6 @@ void dump_lniobuf(struct niobuf_local *nb) }EXPORT_SYMBOL (dump_lniobuf); -void dump_lsm (int level,struct lov_stripe_md *lsm) -{ -CDEBUG (level,"lsm %p, objid " DOSTID ", maxbytes " LPX64 ", magic 0x%08X," -" stripe_size %u, stripe_count %u, refc: %d," -" layout_gen %u, pool [" LOV_POOLNAMEF "]\n" , lsm, -POSTID (&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, - lsm->lsm_stripe_size, lsm->lsm_stripe_count, -atomic_read (&lsm->lsm_refc), lsm->lsm_layout_gen, - lsm->lsm_pool_name); -} -EXPORT_SYMBOL (dump_lsm); -#define LPDS sizeof(__u64)int block_debug_setup (void *addr,int len,__u64 off,__u64 id) {
drivers/staging/lustre/lustre/obdclass/llog_obd.c +1 -28
@@ -226,34 +226,7 @@ int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags) }EXPORT_SYMBOL (llog_sync); -int llog_obd_add (const struct lu_env *env,struct llog_ctxt *ctxt, -struct llog_rec_hdr *rec,struct lov_stripe_md *lsm, -struct llog_cookie *logcookies,int numcookies) -{ -int raised, rc; - -if (!ctxt) { -CERROR ("No ctxt\n" ); -return -ENODEV ; - } - -if (ctxt->loc_flags &LLOG_CTXT_FLAG_UNINITIALIZED ) -return -ENXIO ; - -CTXT_CHECK_OP (ctxt, obd_add, -EOPNOTSUPP ); - raised =cfs_cap_raised (CFS_CAP_SYS_RESOURCE ); -if (!raised) -cfs_cap_raise (CFS_CAP_SYS_RESOURCE ); - rc =CTXTP (ctxt, obd_add)(env, ctxt, rec, lsm, logcookies, - numcookies); -if (!raised) -cfs_cap_lower (CFS_CAP_SYS_RESOURCE ); -return rc; -} -EXPORT_SYMBOL (llog_obd_add); -int llog_cancel (const struct lu_env *env,struct llog_ctxt *ctxt, -struct lov_stripe_md *lsm,int count,struct llog_cookie *cookies,int flags) {int rc;
@@ -264,7 +237,7 @@ int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt, }CTXT_CHECK_OP (ctxt, cancel, -EOPNOTSUPP ); - rc =CTXTP (ctxt, cancel)(env, ctxt, lsm, count, cookies, flags); + rc =CTXTP (ctxt, cancel)(env, ctxt, cookies, flags);return rc; }EXPORT_SYMBOL (llog_cancel);
drivers/staging/lustre/lustre/obdecho/echo_client.c +0 -1
@@ -47,7 +47,6 @@#include <lustre_fid.h> #include <lustre_acl.h> #include <lustre_net.h> -#include <obd_lov.h> #include "echo_internal.h"
drivers/staging/lustre/lustre/osc/osc_request.c +0 -1
@@ -44,7 +44,6 @@#include <lustre/lustre_user.h> #include <obd_cksum.h> #include <obd_ost.h> -#include <obd_lov.h> #include <lustre_ha.h> #include <lprocfs_status.h>
drivers/staging/lustre/lustre/ptlrpc/recover.c +0 -1
@@ -49,7 +49,6 @@#include <obd.h> #include <obd_ost.h> #include <obd_class.h> -#include <obd_lov.h> /* for IOC_LOV_SET_OSC_ACTIVE */ #include <linux/list.h> #include "ptlrpc_internal.h"
Signature · 1 line
1.8.5.3
PATCH 17/47 staging/lustre/hsm: count NULL terminator in hai_zero/hal_size
In reply to Oleg DrokinFrom: Peng Tao <[email protected]>
If fsname is 8-byte aligned, hai_zero fails to count the ending NULL terminator causing hai to directly attached after fsname and future hai_zero will return a different position for first hai.
Reviewed-on: http://review.whamcloud.com/9431
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4689
--- drivers/staging/lustre/lustre/include/lustre/lustre_user.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +3 -2
@@ -1106,7 +1106,8 @@ static inline struct hsm_action_item * hai_zero(struct hsm_action_list *hal) {return (struct hsm_action_item *)(hal->hal_fsname +cfs_size_round (strlen (hal-> \ - hal_fsname))); + hal_fsname) + +1 )); }/* Return pointer to next hai */ static inline struct hsm_action_item *hai_next (struct hsm_action_item *hai)
@@ -1121,7 +1122,7 @@ static inline int hal_size(struct hsm_action_list *hal)int i, sz;struct hsm_action_item *hai; - sz =sizeof (*hal) +cfs_size_round (strlen (hal->hal_fsname)); + sz =sizeof (*hal) +cfs_size_round (strlen (hal->hal_fsname) +1 ); hai =hai_zero (hal);for (i =0 ; i < hal->hal_count; i++, hai =hai_next (hai)) sz +=cfs_size_round (hai->hai_len);
Signature · 1 line
1.8.5.3
PATCH 18/47 staging/lustre/hsm: HSM requests not delivered
In reply to Oleg DrokinFrom: James Nunez <[email protected]>
The total size of an HSM archive request may exceed the desired (LNET) message. When this happens, it can hang the client and not allow the archive request to succeed.
Before we know the total size of the hsm_action_items, we need to limit the size of the reguest. Doing this limits the number of items that can be sent in one archive request. We'e reduced the size allowed for the user archive request to MDS_MAXREQSIZE/3.
Reviewed-on: http://review.whamcloud.com/9393
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4639
--- drivers/staging/lustre/lustre/include/lustre_net.h | 2 ++ drivers/staging/lustre/lustre/llite/dir.c | 5 +++++ 2 files changed, 7 insertions(+)
drivers/staging/lustre/lustre/include/lustre_net.h +2 -0
@@ -264,6 +264,8 @@#define LDLM_MAXREQSIZE (5 * 1024)#define LDLM_MAXREPSIZE (1024) +#define MDS_MAXREQSIZE (5 * 1024)/* >= 4736 */ +#define OST_MAXREQSIZE (5 * 1024)/* Macro to hide a typecast. */
drivers/staging/lustre/lustre/llite/dir.c +5 -0
@@ -1804,6 +1804,11 @@ out_rmdir:/* Compute the whole struct size */ totalsize =hur_len (hur);OBD_FREE_PTR (hur); + +/* Final size will be more than double totalsize */ +if (totalsize >=MDS_MAXREQSIZE /3 ) +return -E2BIG ; +OBD_ALLOC_LARGE (hur, totalsize);if (hur ==NULL )return -ENOMEM ;
Signature · 1 line
1.8.5.3
Re: [PATCH 18/47] staging/lustre/hsm: HSM requests not delivered
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1805
Quoted 7 lines · Oleg Drokin
drivers/staging/lustre/lustre/llite/dir.c +0
-0@@ -1804,6 +1804,11 @@ out_rmdir:/* Compute the whole struct size */ totalsize =hur_len (hur);
hur_len() has an integer overflow bug.
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1810
Quoted 5 lines
drivers/staging/lustre/lustre/llite/dir.c +4
-0OBD_FREE_PTR (hur); + +/* Final size will be more than double totalsize */ +if (totalsize >=MDS_MAXREQSIZE /3 ) +return -E2BIG ;
"totalsize" is signed and this condition doesn't take negatives into consideration. Make totalsize unsigned.
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1812
Quoted 2 lines
drivers/staging/lustre/lustre/llite/dir.c +1
-0+OBD_ALLOC_LARGE (hur, totalsize);
How do we know that "totalsize" is more than sizeof(*hur)? If we fixed the overflow bug then maybe this isn't a problem. I haven't looked.
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1814
Quoted 2 lines
drivers/staging/lustre/lustre/llite/dir.c +0
-0if (hur ==NULL )return -ENOMEM ;
regards,
dan carpenter
Re: [PATCH 18/47] staging/lustre/hsm: HSM requests not delivered
Quoted 9 lines · Dan Carpenter
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1805
Quoted 7 lines · Oleg Drokin
drivers/staging/lustre/lustre/llite/dir.c +0
-0@@ -1804,6 +1804,11 @@ out_rmdir:/* Compute the whole struct size */ totalsize =hur_len (hur);
hur_len()has an integer overflow bug.
Indeed. Thanks.
The below check for the MDS_MAXREQSIZE was aimed at fixing it, I guess. But it's obviously flawed.
Quoted 7 lines
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1810
Quoted 5 lines
drivers/staging/lustre/lustre/llite/dir.c +4
-0OBD_FREE_PTR (hur); + +/* Final size will be more than double totalsize */ +if (totalsize >=MDS_MAXREQSIZE /3 ) +return -E2BIG ;"totalsize" is signed and this condition doesn't take negatives into consideration. Make totalsize unsigned.
In fact we should just enforce a max limit on item count in hur structure above and that would take care of both the overflow and here.
Quoted 4 lines
drivers/staging/lustre/lustre/llite/dir.c out_rmdir: · line 1812
Quoted 2 lines
drivers/staging/lustre/lustre/llite/dir.c +1
-0+OBD_ALLOC_LARGE (hur, totalsize);How do we know that "totalsize" is more than
sizeof(*hur)? If we fixed the overflow bug then maybe this isn't a problem. I haven't looked.
hur_size calculates total size as size of the struct hur (but using offset_of of it's last member that's a zero-sized array + whatever the size of the follow on items.
Bye,
Oleg
PATCH 19/47 staging/lustre: fix permission problem of setfacl
In reply to Oleg DrokinFrom: Li Xi <[email protected]>
Setxattr does not check the permission when setting ACL xattrs. This will cause security problem because any user can walk around permission checking by changing ACL rules.
Reviewed-on: http://review.whamcloud.com/9473
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4704
--- drivers/staging/lustre/lustre/llite/xattr.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/lustre/lustre/llite/xattr.c +5 -0
@@ -124,6 +124,11 @@ int ll_setxattr_common(struct inode *inode, const char *name,if (rc)return rc; +if ((xattr_type ==XATTR_ACL_ACCESS_T || + xattr_type ==XATTR_ACL_DEFAULT_T ) && + !inode_owner_or_capable (inode)) +return -EPERM ; +/* b10667: ignore lustre special xattr for now */ if ((xattr_type ==XATTR_TRUSTED_T &&strcmp (name,"trusted.lov" ) ==0 ) || (xattr_type ==XATTR_LUSTRE_T &&strcmp (name,"lustre.lov" ) ==0 ))
Signature · 1 line
1.8.5.3
PATCH 20/47 staging/lustre/llite: issue OST_SYNC for fsync()
In reply to Oleg DrokinFrom: Bobi Jam <[email protected]>
The last parameter @datasync of fsync() has following indication:
* if datasync=0, we'd always flush data and metadata
* if datasync=1, we'd always flush data while does not flush modifed metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, a change to the file size would require a metadata flush.
Lustre client can not tell the difference easily, and would issue MDS_SYNC and OST_SYNC in all cases.
Reviewed-on: http://review.whamcloud.com/8684
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4388
--- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/file.c +1 -1
@@ -2653,7 +2653,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)if (!err)ptlrpc_req_finished (req); -if (datasync &&S_ISREG (inode->i_mode)) { +if (S_ISREG (inode->i_mode)) {struct ll_file_data *fd =LUSTRE_FPRIVATE (file); err = cl_sync_file_range(inode, 0, OBD_OBJECT_EOF,
Signature · 1 line
1.8.5.3
PATCH 21/47 staging/lustre/llite: deadlock taking lli_trunc_sem during file write
In reply to Oleg DrokinFrom: Bobi Jam <[email protected]>
File write before io loop will take lli_trun_sem read semaphore to protect osc_extent, while after generic_file_aio_write() done, it could possible need to kill suid or sgid, which will call ll_setattr_raw() to change the inode's attribute, and it does not involve size.
So the ll_truc_sem write semaphore should be constrained around ll_setattr_ost() to not come across the lli_trunc_sem read semaphore get from the normal file write path.
Reviewed-on: http://review.whamcloud.com/9267
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4627
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +4 -2
@@ -1449,7 +1449,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)if (attr->ia_valid &ATTR_SIZE )inode_dio_write_done (inode);mutex_unlock (&inode->i_mutex); -down_write (&lli->lli_trunc_sem); }memcpy (&op_data->op_attr, attr,sizeof (*attr));
@@ -1513,7 +1512,11 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)* excessive to send mtime/atime updates to OSTs when not * setting times to past, but it is necessary due to possible * time de-synchronization between MDT inode and OST objects */ +if (attr->ia_valid &ATTR_SIZE ) +down_write (&lli->lli_trunc_sem); rc =ll_setattr_ost (inode, attr); +if (attr->ia_valid &ATTR_SIZE ) +up_write (&lli->lli_trunc_sem); out:if (op_data) {if (op_data->op_ioepoch) {
@@ -1524,7 +1527,6 @@ out:ll_finish_md_op_data (op_data); }if (!S_ISDIR (inode->i_mode)) { -up_write (&lli->lli_trunc_sem);mutex_lock (&inode->i_mutex);if ((attr->ia_valid &ATTR_SIZE ) && !hsm_import)inode_dio_wait (inode);
Signature · 1 line
1.8.5.3
PATCH 22/47 staging/lustre/lov: to not hold sub locks at initialization
In reply to Oleg DrokinFrom: Jinshan Xiong <[email protected]>
Otherwise, it will cause deadlock because it essentially holds some sub locks and then to request others in an arbitrary order.
Reviewed-on: http://review.whamcloud.com/9152
--- drivers/staging/lustre/lustre/lov/lov_lock.c | 36 +--------------------------- 1 file changed, 1 insertion(+), 35 deletions(-)
drivers/staging/lustre/lustre/lov/lov_lock.c +1 -35
@@ -346,41 +346,7 @@ static int lov_lock_sub_init(const struct lu_env *env, } }LASSERT (nr == lck->lls_nr); -/* -* Then, create sub-locks. Once at least one sub-lock was created, -* top-lock can be reached by other threads. -*/ -for (i =0 ; i < lck->lls_nr; ++i) { -struct cl_lock *sublock; -struct lov_lock_link *link; -if (lck->lls_sub[i].sub_lock ==NULL ) { - sublock =lov_sublock_alloc (env, io, lck, i, &link); -if (IS_ERR (sublock)) { - result =PTR_ERR (sublock); -break ; - } -cl_lock_get_trust (sublock); -cl_lock_mutex_get (env, sublock); -cl_lock_mutex_get (env, parent); -/* -* recheck under mutex that sub-lock wasn't created -* concurrently, and that top-lock is still alive. -*/ -if (lck->lls_sub[i].sub_lock ==NULL && - parent->cll_state <CLS_FREEING ) { -lov_sublock_adopt (env, lck, sublock, i, link); -cl_lock_mutex_put (env, parent); - }else { -OBD_SLAB_FREE_PTR (link, lov_lock_link_kmem); -cl_lock_mutex_put (env, parent); -cl_lock_unhold (env, sublock, -"lov-parent" , parent); - } -cl_lock_mutex_put (env, sublock); -cl_lock_put (env, sublock); - } - }/* * Some sub-locks can be missing at this point. This is not a problem, * because enqueue will create them anyway. Main duty of this function
@@ -533,7 +499,7 @@ static int lov_lock_enqueue_one(const struct lu_env *env, struct lov_lock *lck,static int lov_sublock_fill (const struct lu_env *env,struct cl_lock *parent,struct cl_io *io,struct lov_lock *lck,int idx) { -struct lov_lock_link *link; +struct lov_lock_link *link =NULL ;struct cl_lock *sublock;int result;
Signature · 1 line
1.8.5.3
PATCH 23/47 staging/lustre: Limit reply buffer size
In reply to Oleg DrokinFrom: Brian Behlendorf <[email protected]>
When allocating a reply buffer for the striping information don't assume the unlikely worst case. Instead, assume the common case and size the buffer based on the observed default ea/cookie size.
The default size is initialized to a single stripe and allowed to grow up to an entire page if needed. This means that for smallish filesystems (less than ~21 OSTs) where the worst case striping information can fit in a single page there is effectively no change. Only for larger filesystem will the default be less than the maximum. This has a number of advantages.
* By limiting the default reply buffer size we avoid always vmalloc()'ing the buffer because it exceeds four pages in size and instead kmalloc() it. This prevents the client from thrashing on the global vmalloc() spin lock.
* A reply buffer of exactly the right size (no larger) is allocated in the overflow case. These larger reply buffers are still unlikely to exceed the 16k limit where a vmalloc() will occur.
* Saves memory in the common case. Wide striped files exceeded the default are expected to be the exception.
The reason this patch works is because the ptlrpc layer is smart enough to reallocate the reply buffer when an overflow occurs. Therefore the client doesn't have to drop the incoming reply and send a new request with a larger reply buffer.
It's also worth mentioning that the reply buffer always contains a significant amount of extra padding because they are rounded up to the nearest power of two. This means that even files striped wider than the default have a good chance of fitting in the allocated reply buffer.
Also remove client eadatasize check in mdt xattr packing because as said above client can handle -EOVERFLOW.
Reviewed-on: http://review.whamcloud.com/6339
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3338
--- drivers/staging/lustre/lustre/include/lustre_mdc.h | 23 ++++++--- drivers/staging/lustre/lustre/include/obd.h | 15 ++++-- drivers/staging/lustre/lustre/include/obd_class.h | 5 +- .../staging/lustre/lustre/lclient/lcommon_misc.c | 15 ++++-- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 8 ++-- .../staging/lustre/lustre/llite/llite_internal.h | 8 ++-- drivers/staging/lustre/lustre/llite/llite_lib.c | 39 ++++++++++++++++ drivers/staging/lustre/lustre/llite/llite_nfs.c | 4 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 54 ++++++++++++++++++++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 25 ++++++---- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 10 ++-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 8 ++-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 49 +++++++++++++++++--- 14 files changed, 206 insertions(+), 59 deletions(-)
drivers/staging/lustre/lustre/include/lustre_mdc.h +16 -7
@@ -140,17 +140,26 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck,mutex_unlock (&lck->rpcl_mutex); } +/* Update the maximum observed easize and cookiesize. The default easize +* and cookiesize is initialized to the minimum value but allowed to grow +* up to a single page in size if required to handle the common case. +*/ static inline void mdc_update_max_ea_from_body (struct obd_export *exp,struct mdt_body *body) {if (body->valid &OBD_MD_FLMODEASIZE ) { -if (exp->exp_obd->u.cli.cl_max_mds_easize < body->max_mdsize) - exp->exp_obd->u.cli.cl_max_mds_easize = - body->max_mdsize; -if (exp->exp_obd->u.cli.cl_max_mds_cookiesize < - body->max_cookiesize) - exp->exp_obd->u.cli.cl_max_mds_cookiesize = - body->max_cookiesize; +struct client_obd *cli = &exp->exp_obd->u.cli; + +if (cli->cl_max_mds_easize < body->max_mdsize) { + cli->cl_max_mds_easize = body->max_mdsize; + cli->cl_default_mds_easize = +min_t (__u32, body->max_mdsize,PAGE_CACHE_SIZE ); + } +if (cli->cl_max_mds_cookiesize < body->max_cookiesize) { + cli->cl_max_mds_cookiesize = body->max_cookiesize; + cli->cl_default_mds_cookiesize = +min_t (__u32, body->max_cookiesize,PAGE_CACHE_SIZE ); + } } }
drivers/staging/lustre/lustre/include/obd.h +10 -5
@@ -316,9 +316,10 @@ struct client_obd {int cl_conn_count;/* max_mds_easize is purely a performance thing so we don't have to * call obd_size_diskmd() all the time. */ -int cl_default_mds_easize; -int cl_max_mds_easize; -int cl_max_mds_cookiesize; +int cl_default_mds_easize; +int cl_max_mds_easize; +int cl_default_mds_cookiesize; +int cl_max_mds_cookiesize;enum lustre_sec_part cl_sp_me;enum lustre_sec_part cl_sp_to;
@@ -605,6 +606,7 @@ struct lmv_obd {int max_easize;int max_def_easize;int max_cookiesize; +int max_def_cookiesize;int server_timeout;int tgts_size;/* size of tgts array */
@@ -996,7 +998,10 @@ enum obd_cleanup_stage {#define KEY_LOCK_TO_STRIPE "lock_to_stripe"#define KEY_LOVDESC "lovdesc"#define KEY_LOV_IDX "lov_idx" -#define KEY_MAX_EASIZE "max_easize" +#define KEY_MAX_EASIZE "max_easize" +#define KEY_DEFAULT_EASIZE "default_easize" +#define KEY_MAX_COOKIESIZE "max_cookiesize" +#define KEY_DEFAULT_COOKIESIZE "default_cookiesize"#define KEY_MDS_CONN "mds_conn"#define KEY_MGSSEC "mgssec"#define KEY_NEXT_ID "next_id"
@@ -1390,7 +1395,7 @@ struct md_ops { const char *, int, int, int, struct ptlrpc_request **); - int (*m_init_ea_size)(struct obd_export *, int, int, int); + int (*m_init_ea_size)(struct obd_export *, int, int, int, int); int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *, struct obd_export *, struct obd_export *,
drivers/staging/lustre/lustre/include/obd_class.h +3 -2
@@ -2046,12 +2046,13 @@ static inline ldlm_mode_t md_lock_match(struct obd_export *exp, __u64 flags, }static inline int md_init_ea_size (struct obd_export *exp,int easize, -int def_asize,int cookiesize) +int def_asize,int cookiesize, +int def_cookiesize) {EXP_CHECK_MD_OP (exp, init_ea_size);EXP_MD_COUNTER_INCREMENT (exp, init_ea_size);return MDP (exp->exp_obd, init_ea_size)(exp, easize, def_asize, - cookiesize); + cookiesize, def_cookiesize); } static inline int md_get_remote_perm(struct obd_export *exp,
drivers/staging/lustre/lustre/lclient/lcommon_misc.c +10 -5
@@ -56,7 +56,7 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp)__u32 valsize =sizeof (struct lov_desc );int rc, easize, def_easize, cookiesize;struct lov_desc desc; -__u16 stripes; +__u16 stripes, def_stripes; rc =obd_get_info (NULL , dt_exp,sizeof (KEY_LOVDESC ),KEY_LOVDESC , &valsize, &desc,NULL );
@@ -67,15 +67,20 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp) lsm.lsm_stripe_count = stripes; easize =obd_size_diskmd (dt_exp, &lsm); - lsm.lsm_stripe_count = desc.ld_default_stripe_count; + def_stripes =min_t (__u32, desc.ld_default_stripe_count, +LOV_MAX_STRIPE_COUNT ); + lsm.lsm_stripe_count = def_stripes; def_easize =obd_size_diskmd (dt_exp, &lsm); cookiesize = stripes *sizeof (struct llog_cookie ); -CDEBUG (D_HA ,"updating max_mdsize/max_cookiesize: %d/%d\n" , - easize, cookiesize); +/* default cookiesize is 0 because from 2.4 server doesn't send +* llog cookies to client. */ +CDEBUG (D_HA , +"updating def/max_easize: %d/%d def/max_cookiesize: 0/%d\n" , + def_easize, easize, cookiesize); - rc =md_init_ea_size (md_exp, easize, def_easize, cookiesize); + rc =md_init_ea_size (md_exp, easize, def_easize, cookiesize,0 );return rc; }
drivers/staging/lustre/lustre/llite/dir.c +1 -1
@@ -795,7 +795,7 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp,int rc, lmmsize;struct md_op_data *op_data; - rc =ll_get_max_mdsize (sbi, &lmmsize); + rc =ll_get_default_mdsize (sbi, &lmmsize);if (rc)return rc;
drivers/staging/lustre/lustre/llite/file.c +4 -4
@@ -1440,7 +1440,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,struct md_op_data *op_data;int rc, lmmsize; - rc =ll_get_max_mdsize (sbi, &lmmsize); + rc =ll_get_default_mdsize (sbi, &lmmsize);if (rc)return rc;
@@ -2957,7 +2957,7 @@ int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,int ealen =0 ;if (S_ISREG (inode->i_mode)) { - rc =ll_get_max_mdsize (sbi, &ealen); + rc =ll_get_default_mdsize (sbi, &ealen);if (rc)return rc; valid |=OBD_MD_FLEASIZE |OBD_MD_FLMODEASIZE ;
@@ -3359,7 +3359,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock)* layout here. Please note that we can't use the LVB buffer in * completion AST because it doesn't have a large enough buffer */ oc =ll_mdscapa_get (inode); - rc =ll_get_max_mdsize (sbi, &lmmsize); + rc =ll_get_default_mdsize (sbi, &lmmsize);if (rc ==0 ) rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc, OBD_MD_FLXATTR, XATTR_NAME_LOV, NULL, 0,
@@ -3369,7 +3369,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock)return rc; body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -if (body ==NULL || body->eadatasize > lmmsize) +if (body ==NULL )GOTO (out, rc = -EPROTO ); lmmsize = body->eadatasize;
drivers/staging/lustre/lustre/llite/llite_internal.h +3 -5
@@ -865,6 +865,9 @@ void lustre_dump_dentry(struct dentry *, int recur);void lustre_dump_inode (struct inode *);int ll_obd_statfs (struct inode *inode,void *arg);int ll_get_max_mdsize (struct ll_sb_info *sbi,int *max_mdsize); +int ll_get_default_mdsize (struct ll_sb_info *sbi,int *default_mdsize); +int ll_get_max_cookiesize (struct ll_sb_info *sbi,int *max_cookiesize); +int ll_get_default_cookiesize (struct ll_sb_info *sbi,int *default_cookiesize);int ll_process_config (struct lustre_cfg *lcfg); struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, struct inode *i2,
@@ -1127,11 +1130,6 @@ static inline struct lu_fid *ll_inode2fid(struct inode *inode)return fid; } -static inline int ll_mds_max_easize (struct super_block *sb) -{ -return sbi2mdc (ll_s2sbi (sb))->cl_max_mds_easize; -} -static inline __u64 ll_file_maxbytes (struct inode *inode) {return ll_i2info (inode)->lli_maxbytes;
drivers/staging/lustre/lustre/llite/llite_lib.c +39 -0
@@ -634,6 +634,45 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)return rc; } +int ll_get_default_mdsize (struct ll_sb_info *sbi,int *lmmsize) +{ +int size, rc; + + size =sizeof (int ); + rc =obd_get_info (NULL , sbi->ll_md_exp,sizeof (KEY_DEFAULT_EASIZE ), +KEY_DEFAULT_EASIZE , &size, lmmsize,NULL ); +if (rc) +CERROR ("Get default mdsize error rc %d\n" , rc); + +return rc; +} + +int ll_get_max_cookiesize (struct ll_sb_info *sbi,int *lmmsize) +{ +int size, rc; + + size =sizeof (int ); + rc =obd_get_info (NULL , sbi->ll_md_exp,sizeof (KEY_MAX_COOKIESIZE ), +KEY_MAX_COOKIESIZE , &size, lmmsize,NULL ); +if (rc) +CERROR ("Get max cookiesize error rc %d\n" , rc); + +return rc; +} + +int ll_get_default_cookiesize (struct ll_sb_info *sbi,int *lmmsize) +{ +int size, rc; + + size =sizeof (int ); + rc =obd_get_info (NULL , sbi->ll_md_exp,sizeof (KEY_DEFAULT_COOKIESIZE ), +KEY_DEFAULT_COOKIESIZE , &size, lmmsize,NULL ); +if (rc) +CERROR ("Get default cookiesize error rc %d\n" , rc); + +return rc; +} +void ll_dump_inode (struct inode *inode) {struct ll_d_hlist_node *tmp;
drivers/staging/lustre/lustre/llite/llite_nfs.c +2 -2
@@ -98,7 +98,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb,if (inode)return inode; - rc =ll_get_max_mdsize (sbi, &eadatalen); + rc =ll_get_default_mdsize (sbi, &eadatalen);if (rc)return ERR_PTR (rc);
@@ -290,7 +290,7 @@ static struct dentry *ll_get_parent(struct dentry *dchild)CDEBUG (D_INFO ,"getting parent for (%lu," DFID ")\n" , dir->i_ino,PFID (ll_inode2fid (dir))); - rc =ll_get_max_mdsize (sbi, &lmmsize); + rc =ll_get_default_mdsize (sbi, &lmmsize);if (rc !=0 )return ERR_PTR (rc);
drivers/staging/lustre/lustre/llite/lproc_llite.c +51 -3
72 lines not on this page · raw message
drivers/staging/lustre/lustre/lmv/lmv_obd.c +16 -9
@@ -280,7 +280,7 @@ static void lmv_set_timeouts(struct obd_device *obd) }static int lmv_init_ea_size (struct obd_export *exp,int easize, -int def_easize,int cookiesize) +int def_easize,int cookiesize,int def_cookiesize) {struct obd_device *obd = exp->exp_obd;struct lmv_obd *lmv = &obd->u.lmv;
@@ -300,6 +300,10 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize, lmv->max_cookiesize = cookiesize; change =1 ; } +if (lmv->max_def_cookiesize < def_cookiesize) { + lmv->max_def_cookiesize = def_cookiesize; + change =1 ; + }if (change ==0 )return 0 ;
@@ -315,7 +319,7 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize, } rc =md_init_ea_size (lmv->tgts[i]->ltd_exp, easize, def_easize, - cookiesize); + cookiesize, def_cookiesize);if (rc) {CERROR ("%s: obd_init_ea_size() failed on MDT target %d:" " rc = %d.\n" , obd->obd_name, i, rc);
@@ -400,8 +404,8 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) tgt->ltd_exp = mdc_exp; lmv->desc.ld_active_tgt_count++; -md_init_ea_size (tgt->ltd_exp, lmv->max_easize, - lmv->max_def_easize, lmv->max_cookiesize); +md_init_ea_size (tgt->ltd_exp, lmv->max_easize, lmv->max_def_easize, + lmv->max_cookiesize, lmv->max_def_cookiesize); CDEBUG(D_CONFIG, "Connected to %s(%s) successfully (%d)\n", mdc_obd->obd_name, mdc_obd->obd_uuid.uuid,
@@ -527,9 +531,8 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp,spin_unlock (&lmv->lmv_lock); }else {int easize =sizeof (struct lmv_stripe_md ) + - lmv->desc.ld_tgt_count * -sizeof (struct lu_fid ); -lmv_init_ea_size (obd->obd_self_export, easize,0 ,0 ); + lmv->desc.ld_tgt_count *sizeof (struct lu_fid ); +lmv_init_ea_size (obd->obd_self_export, easize,0 ,0 ,0 ); } }
@@ -578,7 +581,7 @@ int lmv_check_connect(struct obd_device *obd)class_export_put (lmv->exp); lmv->connected =1 ; easize =lmv_get_easize (lmv); -lmv_init_ea_size (obd->obd_self_export, easize,0 ,0 ); +lmv_init_ea_size (obd->obd_self_export, easize,0 ,0 ,0 );lmv_init_unlock (lmv);return 0 ;
@@ -2340,7 +2343,11 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp,return 0 ; }return -EINVAL ; - }else if (KEY_IS (KEY_MAX_EASIZE ) ||KEY_IS (KEY_CONN_DATA )) { + }else if (KEY_IS (KEY_MAX_EASIZE ) || +KEY_IS (KEY_DEFAULT_EASIZE ) || +KEY_IS (KEY_MAX_COOKIESIZE ) || +KEY_IS (KEY_DEFAULT_COOKIESIZE ) || +KEY_IS (KEY_CONN_DATA )) { rc =lmv_check_connect (obd);if (rc)return rc;
drivers/staging/lustre/lustre/mdc/mdc_locks.c +5 -5
@@ -442,9 +442,9 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,mdc_unlink_pack (req, op_data);req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , - obddev->u.cli.cl_max_mds_easize); + obddev->u.cli.cl_default_mds_easize);req_capsule_set_size (&req->rq_pill, &RMF_ACL ,RCL_SERVER , - obddev->u.cli.cl_max_mds_cookiesize); + obddev->u.cli.cl_default_mds_cookiesize);ptlrpc_request_set_replen (req);return req; }
@@ -484,10 +484,10 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,/* pack the intended request */ mdc_getattr_pack (req, valid, it->it_flags, op_data, - obddev->u.cli.cl_max_mds_easize); + obddev->u.cli.cl_default_mds_easize);req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , - obddev->u.cli.cl_max_mds_easize); + obddev->u.cli.cl_default_mds_easize);if (client_is_remote (exp))req_capsule_set_size (&req->rq_pill, &RMF_ACL ,RCL_SERVER ,sizeof (struct mdt_remote_perm ));
@@ -528,7 +528,7 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, layout->li_opc =LAYOUT_INTENT_ACCESS ;req_capsule_set_size (&req->rq_pill, &RMF_DLM_LVB ,RCL_SERVER , - obd->u.cli.cl_max_mds_easize); + obd->u.cli.cl_default_mds_easize);ptlrpc_request_set_replen (req);return req; }
drivers/staging/lustre/lustre/mdc/mdc_reint.c +4 -4
@@ -357,9 +357,9 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,mdc_unlink_pack (req, op_data);req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , - obd->u.cli.cl_max_mds_easize); + obd->u.cli.cl_default_mds_easize);req_capsule_set_size (&req->rq_pill, &RMF_LOGCOOKIES ,RCL_SERVER , - obd->u.cli.cl_max_mds_cookiesize); + obd->u.cli.cl_default_mds_cookiesize);ptlrpc_request_set_replen (req); *request = req;
@@ -470,9 +470,9 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,mdc_rename_pack (req, op_data, old, oldlen, new, newlen);req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , - obd->u.cli.cl_max_mds_easize); + obd->u.cli.cl_default_mds_easize);req_capsule_set_size (&req->rq_pill, &RMF_LOGCOOKIES ,RCL_SERVER , - obd->u.cli.cl_max_mds_cookiesize); + obd->u.cli.cl_default_mds_cookiesize);ptlrpc_request_set_replen (req); rc =mdc_reint (req, obd->u.cli.cl_rpc_lock,LUSTRE_IMP_FULL );
drivers/staging/lustre/lustre/mdc/mdc_request.c +42 -7
80 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH 24/47 staging/lustre/llite: Avoid statahead thread start/stop deadlocks
In reply to Oleg DrokinFrom: "Christopher J. Morrone" <[email protected]>
The statahead and statahead agl threads blindly set their thread state to SVC_RUNNING without checking the state first. If, for instance, another thread sets the state to SVC_STOPPING that stop signal will now have been lost. Deadlock ensues.
We also partly improve the sai reference counting, because a race exists where the ll_stop_statahead thread can drop the default reference, and the statahead thread can exit and drop its reference as well. With no references on the sai, the final put will poison and free the buffer. The original do_statahead_enter() function may then continue to access the buffer after it is freed because it did not take a reference of its own. We add a local reference to address that.
Reviewed-on: http://review.whamcloud.com/9358
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4624
--- drivers/staging/lustre/lustre/llite/statahead.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/statahead.c +20 -2
@@ -964,7 +964,11 @@ static int ll_agl_thread(void *arg)atomic_inc (&sbi->ll_agl_total);spin_lock (&plli->lli_agl_lock); sai->sai_agl_valid =1 ; -thread_set_flags (thread,SVC_RUNNING ); +if (thread_is_init (thread)) +/* If someone else has changed the thread state +* (e.g. already changed to SVC_STOPPING), we can't just +* blindly overwrite that setting. */ +thread_set_flags (thread,SVC_RUNNING );spin_unlock (&plli->lli_agl_lock);wake_up (&thread->t_ctl_waitq);
@@ -1058,7 +1062,11 @@ static int ll_statahead_thread(void *arg)atomic_inc (&sbi->ll_sa_total);spin_lock (&plli->lli_sa_lock); -thread_set_flags (thread,SVC_RUNNING ); +if (thread_is_init (thread)) +/* If someone else has changed the thread state +* (e.g. already changed to SVC_STOPPING), we can't just +* blindly overwrite that setting. */ +thread_set_flags (thread,SVC_RUNNING );spin_unlock (&plli->lli_sa_lock);wake_up (&thread->t_ctl_waitq);
@@ -1658,6 +1666,12 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,CDEBUG (D_READA ,"start statahead thread: [pid %d] [parent %.*s]\n" ,current_pid (), parent->d_name.len, parent->d_name.name); +/* The sai buffer already has one reference taken at allocation time, +* but as soon as we expose the sai by attaching it to the lli that +* default reference can be dropped by another thread calling +* ll_stop_statahead. We need to take a local reference to protect +* the sai buffer while we intend to access it. */ +ll_sai_get (sai); lli->lli_sai = sai; plli =ll_i2info (parent->d_inode);
@@ -1670,6 +1684,9 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, lli->lli_opendir_key =NULL ;thread_set_flags (thread,SVC_STOPPED );thread_set_flags (&sai->sai_agl_thread,SVC_STOPPED ); +/* Drop both our own local reference and the default +* reference from allocation time. */ +ll_sai_put (sai);ll_sai_put (sai);LASSERT (lli->lli_sai ==NULL );return -EAGAIN ;
@@ -1678,6 +1695,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,l_wait_event (thread->t_ctl_waitq,thread_is_running (thread) ||thread_is_stopped (thread), &lwi); +ll_sai_put (sai);/* * We don't stat-ahead for the first dirent since we are already in
Signature · 1 line
1.8.5.3
PATCH 25/47 stagaing/lustre: Improve statahead debug messages
In reply to Oleg DrokinFrom: "Christopher J. Morrone" <[email protected]>
The statahead debug messages include the pid of the current process in their body. This is both redudant (because all lustre log messages contain the pid), and sometimes downright misleading. For instance the messages would say something like "stopping statahead thread 3446". One would probably think that 3446 is the pid of the process that is being stopped, but in fact it was the pid of the caller issuing the stop signal.
We remove all superfluous pids from the messages.
Next we have the ll_statahead_thread() and the ll_agl_thread() record their respective pids in their respective ptlrpc_thread structures. This allows to print the pid of the thread that we are trying to stop (which is actually useful info) from other threads, such as those calling ll_stop_statahead().
Reviewed-on: http://review.whamcloud.com/9360
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4624
--- drivers/staging/lustre/lustre/llite/statahead.c | 38 +++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-)
drivers/staging/lustre/lustre/llite/statahead.c +20 -18
@@ -958,8 +958,9 @@ static int ll_agl_thread(void *arg)struct ptlrpc_thread *thread = &sai->sai_agl_thread;struct l_wait_info lwi = {0 }; -CDEBUG (D_READA ,"agl thread started: [pid %d] [parent %.*s]\n" , -current_pid (), parent->d_name.len, parent->d_name.name); + thread->t_pid =current_pid (); +CDEBUG (D_READA ,"agl thread started: sai %p, parent %.*s\n" , + sai, parent->d_name.len, parent->d_name.name);atomic_inc (&sbi->ll_agl_total);spin_lock (&plli->lli_agl_lock);
@@ -1008,8 +1009,8 @@ static int ll_agl_thread(void *arg)spin_unlock (&plli->lli_agl_lock);wake_up (&thread->t_ctl_waitq);ll_sai_put (sai); -CDEBUG (D_READA ,"agl thread stopped: [pid %d] [parent %.*s]\n" , -current_pid (), parent->d_name.len, parent->d_name.name); +CDEBUG (D_READA ,"agl thread stopped: sai %p, parent %.*s\n" , + sai, parent->d_name.len, parent->d_name.name);return 0 ; }
@@ -1020,8 +1021,8 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)struct ll_inode_info *plli;struct task_struct *task; -CDEBUG (D_READA ,"start agl thread: [pid %d] [parent %.*s]\n" , -current_pid (), parent->d_name.len, parent->d_name.name); +CDEBUG (D_READA ,"start agl thread: sai %p, parent %.*s\n" , + sai, parent->d_name.len, parent->d_name.name); plli =ll_i2info (parent->d_inode); task = kthread_run(ll_agl_thread, parent,
@@ -1054,8 +1055,9 @@ static int ll_statahead_thread(void *arg)struct ll_dir_chain chain;struct l_wait_info lwi = {0 }; -CDEBUG (D_READA ,"statahead thread started: [pid %d] [parent %.*s]\n" , -current_pid (), parent->d_name.len, parent->d_name.name); + thread->t_pid =current_pid (); +CDEBUG (D_READA ,"statahead thread starting: sai %p, parent %.*s\n" , + sai, parent->d_name.len, parent->d_name.name);if (sbi->ll_flags &LL_SBI_AGL_ENABLED )ll_start_agl (parent, sai);
@@ -1247,8 +1249,8 @@ out:spin_unlock (&plli->lli_agl_lock);wake_up (&agl_thread->t_ctl_waitq); -CDEBUG (D_READA ,"stop agl thread: [pid %d]\n" , -current_pid ()); +CDEBUG (D_READA ,"stop agl thread: sai %p pid %u\n" , + sai, (unsigned int )agl_thread->t_pid);l_wait_event (agl_thread->t_ctl_waitq,thread_is_stopped (agl_thread), &lwi);
@@ -1274,8 +1276,8 @@ out:wake_up (&thread->t_ctl_waitq);ll_sai_put (sai);dput (parent); -CDEBUG (D_READA ,"statahead thread stopped: [pid %d] [parent %.*s]\n" , -current_pid (), parent->d_name.len, parent->d_name.name); +CDEBUG (D_READA ,"statahead thread stopped: sai %p, parent %.*s\n" , + sai, parent->d_name.len, parent->d_name.name);return rc; }
@@ -1306,8 +1308,8 @@ void ll_stop_statahead(struct inode *dir, void *key)spin_unlock (&lli->lli_sa_lock);wake_up (&thread->t_ctl_waitq); -CDEBUG (D_READA ,"stop statahead thread: [pid %d]\n" , -current_pid ()); +CDEBUG (D_READA ,"stop statahead thread: sai %p pid %u\n" , + lli->lli_sai, (unsigned int )thread->t_pid);l_wait_event (thread->t_ctl_waitq,thread_is_stopped (thread), &lwi);
@@ -1481,10 +1483,10 @@ ll_sai_unplug(struct ll_statahead_info *sai, struct ll_sa_entry *entry)CDEBUG (D_READA ,"Statahead for dir " DFID " hit " "ratio too low: hit/miss " LPU64 "/" LPU64 ", sent/replied " LPU64 "/" LPU64 ", stopping " -"statahead thread: pid %d\n" , +"statahead thread\n" ,PFID (&lli->lli_fid), sai->sai_hit, sai->sai_miss, sai->sai_sent, - sai->sai_replied,current_pid ()); + sai->sai_replied);spin_lock (&lli->lli_sa_lock);if (!thread_is_stopped (thread))thread_set_flags (thread,SVC_STOPPING );
@@ -1663,8 +1665,8 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,GOTO (out, rc = -EAGAIN ); } -CDEBUG (D_READA ,"start statahead thread: [pid %d] [parent %.*s]\n" , -current_pid (), parent->d_name.len, parent->d_name.name); +CDEBUG (D_READA ,"start statahead thread: sai %p, parent %.*s\n" , + sai, parent->d_name.len, parent->d_name.name);/* The sai buffer already has one reference taken at allocation time, * but as soon as we expose the sai by attaching it to the lli that
Signature · 1 line
1.8.5.3
PATCH 26/47 staging/lustre/llite: access layout version under a lock
In reply to Oleg DrokinFrom: Jinshan Xiong <[email protected]>
We used to access layout version under the protection of ldlm lock, this introduces extra overhead for dlm lock matching.
In this patch, lli_layout_lock is introduced to access the layout version. Also, when a layout lock is losing, we should tear down mmap of the correspoding inode to avoid stale data accessing in the future.
This is part of technical verification of replication.
Reviewed-on: http://review.whamcloud.com/8689
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3254
--- drivers/staging/lustre/lustre/llite/file.c | 22 ++++----------- .../staging/lustre/lustre/llite/llite_internal.h | 21 ++++++++++++++- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 31 ++++++++++++++++------ 5 files changed, 51 insertions(+), 28 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +5 -17
@@ -3436,7 +3436,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, ldlm_mode_t mode,if (lvb_ready) {/* layout_gen must be valid if layout lock is not * cancelled and stripe has already set */ - *gen = lli->lli_layout_gen; + *gen =ll_layout_version_get (lli); rc =0 ; }GOTO (out, rc);
@@ -3534,32 +3534,20 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen) };int rc; - *gen = lli->lli_layout_gen; -if (!(sbi->ll_flags &LL_SBI_LAYOUT_LOCK )) + *gen =ll_layout_version_get (lli); +if (!(sbi->ll_flags &LL_SBI_LAYOUT_LOCK ) || *gen !=LL_LAYOUT_GEN_NONE )return 0 ;/* sanity checks */ LASSERT (fid_is_sane (ll_inode2fid (inode)));LASSERT (S_ISREG (inode->i_mode)); -/* mostly layout lock is caching on the local side, so try to match -* it before grabbing layout lock mutex. */ - mode =ll_take_md_lock (inode,MDS_INODELOCK_LAYOUT , &lockh,0 , -LCK_CR |LCK_CW |LCK_PR |LCK_PW ); -if (mode !=0 ) {/* hit cached lock */ - rc =ll_layout_lock_set (&lockh, mode, inode, gen, false); -if (rc ==0 ) -return 0 ; - -/* better hold lli_layout_mutex to try again otherwise -* it will have starvation problem. */ - } -/* take layout lock mutex to enqueue layout lock exclusively. */ mutex_lock (&lli->lli_layout_mutex); again: -/* try again. Maybe somebody else has done this. */ +/* mostly layout lock is caching on the local side, so try to match +* it before grabbing layout lock mutex. */ mode =ll_take_md_lock (inode,MDS_INODELOCK_LAYOUT , &lockh,0 ,LCK_CR |LCK_CW |LCK_PR |LCK_PW );if (mode !=0 ) {/* hit cached lock */
drivers/staging/lustre/lustre/llite/llite_internal.h +20 -1
@@ -280,14 +280,33 @@ struct ll_inode_info {/* mutex to request for layout lock exclusively. */ struct mutex lli_layout_mutex; -/* valid only inside LAYOUT ibits lock, protected by lli_layout_mutex */ +/* Layout version, protected by lli_layout_lock */ __u32 lli_layout_gen; +spinlock_t lli_layout_lock;struct rw_semaphore lli_xattrs_list_rwsem;struct mutex lli_xattrs_enq_lock;struct list_head lli_xattrs;/* ll_xattr_entry->xe_list */ }; +static inline __u32 ll_layout_version_get (struct ll_inode_info *lli) +{ +__u32 gen; + +spin_lock (&lli->lli_layout_lock); + gen = lli->lli_layout_gen; +spin_unlock (&lli->lli_layout_lock); + +return gen; +} + +static inline void ll_layout_version_set (struct ll_inode_info *lli,__u32 gen) +{ +spin_lock (&lli->lli_layout_lock); + lli->lli_layout_gen = gen; +spin_unlock (&lli->lli_layout_lock); +} +int ll_xattr_cache_destroy (struct inode *inode); int ll_xattr_cache_get(struct inode *inode,
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -1
@@ -966,7 +966,8 @@ void ll_lli_init(struct ll_inode_info *lli)mutex_init (&lli->lli_och_mutex);spin_lock_init (&lli->lli_agl_lock); lli->lli_has_smd = false; - lli->lli_layout_gen =LL_LAYOUT_GEN_NONE ; +spin_lock_init (&lli->lli_layout_lock); +ll_layout_version_set (lli,LL_LAYOUT_GEN_NONE ); lli->lli_clob =NULL ;init_rwsem (&lli->lli_xattrs_list_rwsem);
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -1
@@ -80,7 +80,7 @@ static bool can_populate_pages(const struct lu_env *env, struct cl_io *io,case CIT_WRITE :/* don't need lock here to check lli_layout_gen as we have held * extent lock and GROUP lock has to hold to swap layout */ -if (lli->lli_layout_gen != cio->cui_layout_gen) { +if (ll_layout_version_get (lli) != cio->cui_layout_gen) { io->ci_need_restart =1 ;/* this will return application a short read/write */ io->ci_continue =0 ;
drivers/staging/lustre/lustre/llite/vvp_object.c +23 -8
@@ -126,7 +126,22 @@ int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,struct ll_inode_info *lli =ll_i2info (conf->coc_inode);if (conf->coc_opc ==OBJECT_CONF_INVALIDATE ) { - lli->lli_layout_gen =LL_LAYOUT_GEN_NONE ; +CDEBUG (D_VFSTRACE ,DFID ": losing layout lock\n" , +PFID (&lli->lli_fid)); + +ll_layout_version_set (lli,LL_LAYOUT_GEN_NONE ); + +/* Clean up page mmap for this inode. +* The reason for us to do this is that if the page has +* already been installed into memory space, the process +* can access it without interacting with lustre, so this +* page may be stale due to layout change, and the process +* will never be notified. +* This operation is expensive but mmap processes have to pay +* a price themselves. */ +unmap_mapping_range (conf->coc_inode->i_mapping, +0 ,OBD_OBJECT_EOF ,0 ); +return 0 ; }
@@ -134,18 +149,18 @@ int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,return 0 ;if (conf->u.coc_md !=NULL && conf->u.coc_md->lsm !=NULL ) { -CDEBUG (D_VFSTRACE ,"layout lock change: %u -> %u\n" , - lli->lli_layout_gen, - conf->u.coc_md->lsm->lsm_layout_gen); +CDEBUG (D_VFSTRACE ,DFID ": layout version change: %u -> %u\n" , +PFID (&lli->lli_fid), lli->lli_layout_gen, + conf->u.coc_md->lsm->lsm_layout_gen); lli->lli_has_smd =lsm_has_objects (conf->u.coc_md->lsm); - lli->lli_layout_gen = conf->u.coc_md->lsm->lsm_layout_gen; +ll_layout_version_set (lli, conf->u.coc_md->lsm->lsm_layout_gen); }else { -CDEBUG (D_VFSTRACE ,"layout lock destroyed: %u.\n" , - lli->lli_layout_gen); +CDEBUG (D_VFSTRACE ,DFID ": layout nuked: %u.\n" , +PFID (&lli->lli_fid), lli->lli_layout_gen); lli->lli_has_smd = false; - lli->lli_layout_gen =LL_LAYOUT_GEN_EMPTY ; +ll_layout_version_set (lli,LL_LAYOUT_GEN_EMPTY ); }return 0 ; }
Signature · 1 line
1.8.5.3
PATCH 27/47 staging/lustre: shrink lu_object_header by 8 bytes on x86_64
In reply to Oleg DrokinFrom: Andreas Dilger <[email protected]>
Locate the loh_flags and loh_ref fields together in lu_object_header to avoid holes and shrink the structure by 8 bytes.
Reviewed-on: http://review.whamcloud.com/9185
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3059
--- drivers/staging/lustre/lustre/include/lu_object.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +4 -4
@@ -516,6 +516,10 @@ enum lu_object_header_attr {*/ struct lu_object_header {/** +* Fid, uniquely identifying this object. +*/ +struct lu_fid loh_fid; +/** * Object flags from enum lu_object_header_flags. Set and checked * atomically. */
@@ -525,10 +529,6 @@ struct lu_object_header {*/ atomic_t loh_ref;/** -* Fid, uniquely identifying this object. -*/ -struct lu_fid loh_fid; -/** * Common object attributes, cached for efficiency. From enum * lu_object_header_attr. */
Signature · 1 line
1.8.5.3
PATCH 28/47 staging/lustre/ldlm: fix NULL pointer dereference
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
Pointer '*exp' returned from call to function 'class_conn2export' at line 523 may be NULL and may be dereferenced at line 543.
Reviewed-on: http://review.whamcloud.com/9323
ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
--- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +1 -1
@@ -514,7 +514,7 @@ int client_connect_import(const struct lu_env *env,LASSERT (imp->imp_state ==LUSTRE_IMP_DISCON );GOTO (out_ldlm, rc); } -LASSERT ((*exp)->exp_connection); +LASSERT (*exp !=NULL && (*exp)->exp_connection);if (data) { LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) ==
Signature · 1 line
1.8.5.3
PATCH 29/47 staging/lustre/lnet: lnet: fix issues found by Klocwork Insight tool
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
Null pointer 'cp' that comes from line 2544 may be dereferenced at line 2618.
Pointer 'ni' checked for NULL at line 1569 may be passed to function and may be dereferenced there by passing argument 1 to function 'lnet_ni_notify_locked' at line 1621.
Null pointer 'best_iface' that comes from line 802 may be dereferenced at line 832.
Buffer overflow of string buffer due to non null terminated string.
Pointer 'tsc' returned from call to function 'sfw_find_test_case' at line 571 may be NULL and will be dereferenced at line 572.
Local variable 'hash' is never used.
Reviewed-on: http://review.whamcloud.com/9386
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++++++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +++--- drivers/staging/lustre/lnet/lnet/router.c | 3 ++- drivers/staging/lustre/lnet/selftest/conctl.c | 11 +++++++---- drivers/staging/lustre/lnet/selftest/framework.c | 14 +++++++++++--- 6 files changed, 31 insertions(+), 15 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +6 -2
@@ -2609,13 +2609,17 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob)case IBLND_REJECT_MSG_QUEUE_SIZE :CERROR ("%s rejected: incompatible message queue depth %d, %d\n" , -libcfs_nid2str (peer->ibp_nid), cp->ibcp_queue_depth, +libcfs_nid2str (peer->ibp_nid), + cp !=NULL ? cp->ibcp_queue_depth : +IBLND_MSG_QUEUE_SIZE (rej->ibr_version),IBLND_MSG_QUEUE_SIZE (conn->ibc_version));break ;case IBLND_REJECT_RDMA_FRAGS :CERROR ("%s rejected: incompatible # of RDMA fragments %d, %d\n" , -libcfs_nid2str (peer->ibp_nid), cp->ibcp_max_frags, +libcfs_nid2str (peer->ibp_nid), + cp !=NULL ? cp->ibcp_max_frags : +IBLND_RDMA_FRAGS (rej->ibr_version),IBLND_RDMA_FRAGS (conn->ibc_version));break ;
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +2 -2
@@ -829,14 +829,14 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) best_npeers = iface->ksni_npeers; } +LASSERT (best_iface !=NULL ); + best_iface->ksni_npeers++; ip = best_iface->ksni_ipaddr; peer->ksnp_passive_ips[i] = ip; peer->ksnp_n_passive_ips = i+1 ; } -LASSERT (best_iface !=NULL ); -/* mark the best matching peer IP used */ j =ksocknal_match_peerip (best_iface, peerips, n_peerips); peerips[j] =0 ;
drivers/staging/lustre/lnet/lnet/api-ni.c +3 -3
@@ -127,8 +127,7 @@ lnet_create_remote_nets_table(void)static void lnet_destroy_remote_nets_table (void ) { -int i; -struct list_head *hash; +int i;if (the_lnet.ln_remote_nets_hash ==NULL )return ;
@@ -137,7 +136,8 @@ lnet_destroy_remote_nets_table(void)LASSERT (list_empty (&the_lnet.ln_remote_nets_hash[i]));LIBCFS_FREE (the_lnet.ln_remote_nets_hash, -LNET_REMOTE_NETS_HASH_SIZE *sizeof (*hash)); +LNET_REMOTE_NETS_HASH_SIZE * +sizeof (the_lnet.ln_remote_nets_hash[0 ])); the_lnet.ln_remote_nets_hash =NULL ; }
drivers/staging/lustre/lnet/lnet/router.c +2 -1
@@ -1559,7 +1559,8 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, cfs_time_t when)lnet_notify_locked (lp, ni ==NULL , alive, when); -lnet_ni_notify_locked (ni, lp); +if (ni !=NULL ) +lnet_ni_notify_locked (ni, lp);lnet_peer_decref_locked (lp);
drivers/staging/lustre/lnet/selftest/conctl.c +7 -4
@@ -764,13 +764,18 @@ int lst_test_add_ioctl(lstio_test_args_t *args) goto out;LIBCFS_ALLOC (dst_name, args->lstio_tes_dgrp_nmlen +1 ); -if (dst_name ==NULL ) +if (dst_name ==NULL ) goto out;if (args->lstio_tes_param !=NULL ) {LIBCFS_ALLOC (param, args->lstio_tes_param_len);if (param ==NULL ) goto out; +if (copy_from_user (param, args->lstio_tes_param, + args->lstio_tes_param_len)) { + rc = -EFAULT ; + goto out; + } } rc = -EFAULT ;
@@ -779,9 +784,7 @@ int lst_test_add_ioctl(lstio_test_args_t *args)copy_from_user (src_name, args->lstio_tes_sgrp_name, args->lstio_tes_sgrp_nmlen) ||copy_from_user (dst_name, args->lstio_tes_dgrp_name, - args->lstio_tes_dgrp_nmlen) || -copy_from_user (param, args->lstio_tes_param, - args->lstio_tes_param_len)) + args->lstio_tes_dgrp_nmlen)) goto out; rc = lstcon_test_add(batch_name,
drivers/staging/lustre/lnet/selftest/framework.c +11 -3
@@ -547,10 +547,16 @@ sfw_test_rpc_fini (srpc_client_rpc_t *rpc)static inline int sfw_test_buffers (sfw_test_instance_t *tsi) { -struct sfw_test_case *tsc =sfw_find_test_case (tsi->tsi_service); -struct srpc_service *svc = tsc->tsc_srv_service; +struct sfw_test_case *tsc; +struct srpc_service *svc;int nbuf; +LASSERT (tsi !=NULL ); + tsc =sfw_find_test_case (tsi->tsi_service); +LASSERT (tsc !=NULL ); + svc = tsc->tsc_srv_service; +LASSERT (svc !=NULL ); + nbuf =min (svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts;return max (SFW_TEST_WI_MIN , nbuf +SFW_TEST_WI_EXTRA ); }
@@ -595,8 +601,10 @@ sfw_load_test(struct sfw_test_instance *tsi)void sfw_unload_test (struct sfw_test_instance *tsi) { -struct sfw_test_case *tsc =sfw_find_test_case (tsi->tsi_service); +struct sfw_test_case *tsc; +LASSERT (tsi !=NULL ); + tsc =sfw_find_test_case (tsi->tsi_service);LASSERT (tsc !=NULL );if (tsi->tsi_is_client)
Signature · 1 line
1.8.5.3
Greg Kroah-Hartman
maintainerRe: [PATCH 29/47] staging/lustre/lnet: lnet: fix issues found by Klocwork Insight tool
Quoted 12 lines · Oleg Drokin
From: Dmitry Eremin <[email protected]>
Null pointer 'cp' that comes from line 2544 may be dereferenced at line 2618.
Pointer 'ni' checked for NULL at line 1569 may be passed to function and may be dereferenced there by passing argument 1 to function '
lnet_ni_notify_locked' at line 1621.Null pointer '
best_iface' that comes from line 802 may be dereferenced at line 832.
Quoted 6 lines
Buffer overflow of string buffer due to non null terminated string.
Pointer 'tsc' returned from call to function '
sfw_find_test_case' at line 571 may be NULL and will be dereferenced at line 572.Local variable 'hash' is never used.
Each kernel patch should only do one thing, not 6 different things. Please break this up into 6 different patches.
thanks,
greg k-h
PATCH 30/47 staging/lustre/mdc: fix issue found by Klocwork Insight tool
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
Pointer 'mod' checked for NULL at line 160 may be dereferenced at line 208.
Reviewed-on: http://review.whamcloud.com/9387
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
--- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/mdc/mdc_reint.c +2 -1
@@ -199,7 +199,8 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, *request = req;if (rc && req->rq_commit_cb) {/* Put an extra reference on \var mod on error case. */ -obd_mod_put (*mod); +if (mod !=NULL && *mod !=NULL ) +obd_mod_put (*mod); req->rq_commit_cb (req); }return rc;
Signature · 1 line
1.8.5.3
Re: [PATCH 30/47] staging/lustre/mdc: fix issue found by Klocwork Insight tool
Quoted 4 lines · Oleg Drokin
From: Dmitry Eremin <[email protected]>
Pointer 'mod' checked for NULL at line 160 may be dereferenced at line 208.
This seems to be a real bug, btw. For example, FSFILT_IOC_SETFLAGS calls md_setattr() with a NULL mod in ll_iocontrol().
regards,
dan carpenter
PATCH 31/47 staging/lustre/libcfs: fix issues found by Klocwork Insight tool
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
sscanf format specification '%u' expects type 'unsigned int *' for 'u', but parameter 3 has a different type 'int*'.
Reviewed-on: http://review.whamcloud.com/9400
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
--- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 2 +- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +1 -1
@@ -881,7 +881,7 @@ cfs_cpt_table_create_pattern(char *pattern)break ; } -if (sscanf (str,"%u%n" , &cpt, &n) <1 ) { +if (sscanf (str,"%d%n" , &cpt, &n) <1 ) {CERROR ("Invalid cpu pattern %s\n" , str); goto failed; }
drivers/staging/lustre/lustre/libcfs/nidstrings.c +6 -6
@@ -227,11 +227,11 @@ libcfs_ip_addr2str(__u32 addr, char *str)int libcfs_ip_str2addr (const char *str,int nob,__u32 *addr) { -int a; -int b; -int c; -int d; -int n = nob;/* XscanfX */ +unsigned int a; +unsigned int b; +unsigned int c; +unsigned int d; +int n = nob;/* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 &&
@@ -419,7 +419,7 @@ libcfs_str2net_internal(const char *str, __u32 *net) {struct netstrfns *uninitialized_var (nf );int nob; -int netnum; +unsigned int netnum;int i;for (i =0 ; i < libcfs_nnetstrfns; i++) {
Signature · 1 line
1.8.5.3
PATCH 32/47 staging/lustre/lnet: NI shutdown may loop forever
In reply to Oleg DrokinFrom: Liang Zhen <[email protected]>
lnet_shutdown_lndnis() may enter endless loop if there is a busy NI, this is injected by LNet SMP improvements. It's fixed in this patch.
Reviewed-on: http://review.whamcloud.com/9706
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4780
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +4 -3
@@ -986,12 +986,11 @@ lnet_shutdown_lndnis (void)break ; } -while (!list_empty (&ni->ni_list)) { +if (!list_empty (&ni->ni_list)) {lnet_net_unlock (LNET_LOCK_EX ); ++i;if ((i & (-i)) == i) { -CDEBUG (D_WARNING , -"Waiting for zombie LNI %s\n" , +CDEBUG (D_WARNING ,"Waiting for zombie LNI %s\n" ,libcfs_nid2str (ni->ni_nid)); }set_current_state (TASK_UNINTERRUPTIBLE );
@@ -1016,6 +1015,8 @@ lnet_shutdown_lndnis (void) libcfs_nid2str(ni->ni_nid));lnet_ni_free (ni); + i =2 ; +lnet_net_lock (LNET_LOCK_EX ); }
Signature · 1 line
1.8.5.3
PATCH 33/47 staging/lustre: remove lustre/include/ioctl.h
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
Remove the nowhere included header lustre/include/ioctl.h.
Reviewed-on: http://review.whamcloud.com/9757
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
--- drivers/staging/lustre/lustre/include/ioctl.h | 106 -------------------------- 1 file changed, 106 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/ioctl.h
drivers/staging/lustre/lustre/include/ioctl.h deleted +0 -106
@@ -1,106 +0,0 @@ -/* -* GPL HEADER START -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 only, -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License version 2 for more details (a copy is included -* in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU General Public License -* version 2 along with this program; If not, see -* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf -* -* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -* CA 95054 USA or visit www.sun.com if you need additional information or -* have any questions. -* -* GPL HEADER END -*/ -/* -* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -* Use is subject to license terms. -*/ -/* -* This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. -*/ - -#ifndef _IOWR - -/* On i386 and x86_64, _ASM_I386_IOCTL_H is defined by the kernel's ioctl.h, -* and on newer kernels this header is shared as _ASM_GENERIC_IOCTL_H. -* -* We can avoid any problems with the kernel header being included again by -* defining _ASM_I386_IOCTL_H here so that a later occurrence of <asm/ioctl.h> -* does not include the kernel's ioctl.h after this one. b=14746 */ -#define _ASM_I386_IOCTL_H -#define _ASM_GENERIC_IOCTL_H - -/* ioctl command encoding: 32 bits total, command in lower 16 bits, -* size of the parameter structure in the lower 14 bits of the -* upper 16 bits. -* Encoding the size of the parameter structure in the ioctl request -* The highest 2 bits are reserved for indicating the ``access mode''. -* NOTE: This limits the max parameter size to 16kB -1 ! -*/ - -/* -* The following is for compatibility across the various Linux -* platforms. The i386 ioctl numbering scheme doesn't really enforce -* a type field. De facto, however, the top 8 bits of the lower 16 -* bits are indeed used as a type field, so we might just as well make -* this explicit here. Please be sure to use the decoding macros -* below from now on. -*/ -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS 2 - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* -* Direction bits. -*/ -#define _IOC_NONE 0U -#define _IOC_WRITE 1U -#define _IOC_READ 2U - -#define _IOC (dir,type,nr,size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT)) - -/* used to create numbers */ -#define _IO (type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR (type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW (type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR (type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode ioctl numbers.. */ -#define _IOC_DIR (nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE (nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR (nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE (nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* ...and for the drivers/sound files... */ - -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) - -#endif /* _IOWR */
Signature · 1 line
1.8.5.3
PATCH 34/47 staging/lustre/libcfs: add CPU table functions for uniprocessor
In reply to Oleg DrokinFrom: Li Xi <[email protected]>
Some CPU table functions for uniprocessor architecture is missing.
Reviewed-on: http://review.whamcloud.com/8873
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199
--- .../lustre/include/linux/libcfs/libcfs_cpu.h | 5 +++++ .../lustre/include/linux/libcfs/linux/linux-mem.h | 5 +++++ drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+)
drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +5 -0
@@ -203,6 +203,11 @@ void cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt);int cfs_cpt_spread_node (struct cfs_cpt_table *cptab,int cpt);/** +* return number of HTs in the same core of \a cpu +*/ +int cfs_cpu_ht_nsiblings (int cpu); + +/** * iterate over all CPU partitions in \a cptab */ #define cfs_cpt_for_each (i, cptab) \
drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h +5 -0
@@ -53,6 +53,11 @@#include <linux/memcontrol.h> #include <linux/mm_inline.h> +#ifndef HAVE_LIBCFS_CPT +/* Need this for cfs_cpt_table */ +#include <libcfs/libcfs_cpu.h> +#endif +#define CFS_PAGE_MASK (~((__u64)PAGE_CACHE_SIZE-1))#define page_index (p) ((p)->index)
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +21 -0
@@ -75,6 +75,20 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab)EXPORT_SYMBOL (cfs_cpt_table_free);int +cfs_cpt_table_print (struct cfs_cpt_table *cptab,char *buf,int len) +{ +int rc =0 ; + + rc =snprintf (buf, len,"%d\t: %d\n" ,0 ,0 ); + len -= rc; +if (len <=0 ) +return -EFBIG ; + +return rc; +} +EXPORT_SYMBOL (cfs_cpt_table_print); + +int cfs_cpt_number (struct cfs_cpt_table *cptab) {return 1 ;
@@ -161,6 +175,13 @@ cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt)EXPORT_SYMBOL (cfs_cpt_spread_node);int +cfs_cpu_ht_nsiblings (int cpu) +{ +return 1 ; +} +EXPORT_SYMBOL (cfs_cpu_ht_nsiblings); + +int cfs_cpt_current (struct cfs_cpt_table *cptab,int remap) {return 0 ;
Signature · 1 line
1.8.5.3
Re: [PATCH 34/47] staging/lustre/libcfs: add CPU table functions for uniprocessor
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c cfs_cpt_table_free(struct cfs_cpt_table *cptab) · line 80
Quoted 4 lines · Oleg Drokin
int
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +3
-0+cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) +{ + int rc = 0;
GCC has a feature where it warns about unitialized variables. If you do bogus it disables this safety feature. Also the bogus assignment is confusing for people trying to read the code.
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c cfs_cpt_table_free(struct cfs_cpt_table *cptab) · line 85
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +5
-0+ + rc =snprintf (buf, len,"%d\t: %d\n" ,0 ,0 ); + len -= rc; +if (len <=0 ) +return -EFBIG ;
It would be more clear to say:
rc = snprintf(buf, len, "%d\t: %d\n", 0, 0); if (rc >= len) return -EFBIG; return rc;
regards,
dan carpenter
Quoted 5 lines
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +5
-0+ +return rc; +} +EXPORT_SYMBOL (cfs_cpt_table_print); +
PATCH 35/47 staging/lustre: replace semaphores with mutexes
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
It's just optimization. The mutex subsystem is slightly faster and has better scalability for contended workloads.
Remove the lustre_lock and it's accessor functions l_lock(), l_unlock(), l_lock_init(), and l_has_lock() since they have not been used by the code since Lustre 1.6.
Reviewed-on: http://review.whamcloud.com/9294
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4588
--- drivers/staging/lustre/lustre/include/lustre_lib.h | 13 ------------- drivers/staging/lustre/lustre/include/obd.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 16 ++++++++-------- drivers/staging/lustre/lustre/mgc/mgc_request.c | 8 ++++---- 5 files changed, 14 insertions(+), 27 deletions(-)
drivers/staging/lustre/lustre/include/lustre_lib.h +0 -13
@@ -94,19 +94,6 @@ struct obd_client_handle {void statfs_pack (struct obd_statfs *osfs,struct kstatfs *sfs);void statfs_unpack (struct kstatfs *sfs,struct obd_statfs *osfs); -/* l_lock.c */ -struct lustre_lock { -int l_depth; -struct task_struct *l_owner; -struct semaphore l_sem; -spinlock_t l_spin; -}; - -void l_lock_init (struct lustre_lock *); -void l_lock (struct lustre_lock *); -void l_unlock (struct lustre_lock *); -int l_has_lock (struct lustre_lock *); -/* * For md echo client */
drivers/staging/lustre/lustre/include/obd.h +1 -1
@@ -406,7 +406,7 @@ struct client_obd {struct mdc_rpc_lock *cl_close_lock;/* mgc datastruct */ -struct semaphore cl_mgc_sem; +struct mutex cl_mgc_mutex;struct local_oid_storage *cl_mgc_los;struct dt_object *cl_mgc_configs_dir;atomic_t cl_mgc_refcount;
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +1 -1
@@ -325,7 +325,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) }init_rwsem (&cli->cl_sem); -sema_init (&cli->cl_mgc_sem,1 ); +mutex_init (&cli->cl_mgc_mutex); cli->cl_conn_count =0 ; memcpy(server_uuid.uuid, lustre_cfg_buf(lcfg, 2), min_t(unsigned int, LUSTRE_CFG_BUFLEN(lcfg, 2),
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +8 -8
@@ -71,7 +71,7 @@ struct cfs_cpt_data {/* reserved for hotplug */ unsigned long cpt_version;/* mutex to protect cpt_cpumask */ -struct semaphore cpt_mutex; +struct mutex cpt_mutex;/* scratch buffer for set/unset_node */ cpumask_t *cpt_cpumask; };
@@ -420,14 +420,14 @@ cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)return 0 ; } -down (&cpt_data.cpt_mutex); +mutex_lock (&cpt_data.cpt_mutex); mask = cpt_data.cpt_cpumask;cfs_node_to_cpumask (node, mask); rc =cfs_cpt_set_cpumask (cptab, cpt, mask); -up (&cpt_data.cpt_mutex); +mutex_unlock (&cpt_data.cpt_mutex);return rc; }
@@ -444,14 +444,14 @@ cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)return ; } -down (&cpt_data.cpt_mutex); +mutex_lock (&cpt_data.cpt_mutex); mask = cpt_data.cpt_cpumask;cfs_node_to_cpumask (node, mask);cfs_cpt_unset_cpumask (cptab, cpt, mask); -up (&cpt_data.cpt_mutex); +mutex_unlock (&cpt_data.cpt_mutex); }EXPORT_SYMBOL (cfs_cpt_unset_node);
@@ -969,11 +969,11 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)break ; } -down (&cpt_data.cpt_mutex); +mutex_lock (&cpt_data.cpt_mutex);/* if all HTs in a core are offline, it may break affinity */ cfs_cpu_ht_siblings (cpu, cpt_data.cpt_cpumask); warn =any_online_cpu (*cpt_data.cpt_cpumask) >= nr_cpu_ids; -up (&cpt_data.cpt_mutex); +mutex_unlock (&cpt_data.cpt_mutex);CDEBUG (warn ?D_WARNING :D_INFO ,"Lustre: can't support CPU plug-out well now, " "performance and stability could be impacted "
@@ -1017,7 +1017,7 @@ cfs_cpu_init(void) }spin_lock_init (&cpt_data.cpt_lock); -sema_init (&cpt_data.cpt_mutex,1 ); +mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU register_hotcpu_notifier (&cfs_cpu_notifier);
drivers/staging/lustre/lustre/mgc/mgc_request.c +4 -4
@@ -672,8 +672,8 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb)if (env ==NULL )return -ENOMEM ; -/* The mgc fs exclusion sem. Only one fs can be setup at a time. */ -down (&cli->cl_mgc_sem); +/* The mgc fs exclusion mutex. Only one fs can be setup at a time. */ +mutex_lock (&cli->cl_mgc_mutex);cfs_cleanup_group_info ();
@@ -727,7 +727,7 @@ out_los:if (rc <0 ) {local_oid_storage_fini (env, cli->cl_mgc_los); cli->cl_mgc_los =NULL ; -up (&cli->cl_mgc_sem); +mutex_unlock (&cli->cl_mgc_mutex); } out_env:lu_env_fini (env);
@@ -759,7 +759,7 @@ static int mgc_fs_cleanup(struct obd_device *obd) unlock:class_decref (obd,"mgc_fs" , obd); -up (&cli->cl_mgc_sem); +mutex_unlock (&cli->cl_mgc_mutex);return 0 ; }
Signature · 1 line
1.8.5.3
PATCH 36/47 staging/lustre/clio: replace semaphore with mutex
In reply to Oleg DrokinFrom: Dmitry Eremin <[email protected]>
According https://www.kernel.org/doc/Documentation/mutex-design.txt:
- the mutex subsystem is slightly faster and has better scalability for contended workloads. In terms of 'ops per CPU cycle', the semaphore kernel performed 551 ops/sec per 1% of CPU time used, while the mutex kernel performed 3825 ops/sec per 1% of CPU time used - it was 6.9 times more efficient.
- there are no fastpath tradeoffs, the mutex fastpath is just as tight as the semaphore fastpath. On x86, the locking fastpath is 2 instructions.
- 'struct mutex' semantics are well-defined and are enforced if CONFIG_DEBUG_MUTEXES is turned on. Semaphores on the other hand have virtually no debugging code or instrumentation.
One more benefit of mutex is optimistic spinning. It try to spin for acquisition when there are no pending waiters and the lock owner is currently running on a (different) CPU. The rationale is that if the lock owner is running, it is likely to release the lock soon.
This significantly reduce amount of context switches when locked region is small and we have high contention.
Reviewed-on: http://review.whamcloud.com/9095
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4257
--- drivers/staging/lustre/lustre/llite/llite_internal.h | 10 ++++------ drivers/staging/lustre/lustre/llite/llite_lib.c | 12 +++--------- 2 files changed, 7 insertions(+), 15 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +4 -6
@@ -211,8 +211,7 @@ struct ll_inode_info {/* for non-directory */ struct { -struct semaphore f_size_sem; -void *f_size_sem_owner; +struct mutex f_size_mutex;char *f_symlink_name;__u64 f_maxbytes;/*
@@ -249,8 +248,7 @@ struct ll_inode_info {char f_jobid[JOBSTATS_JOBID_SIZE ]; } f; -#define lli_size_sem u.f.f_size_sem -#define lli_size_sem_owner u.f.f_size_sem_owner +#define lli_size_mutex u.f.f_size_mutex#define lli_symlink_name u.f.f_symlink_name#define lli_maxbytes u.f.f_maxbytes#define lli_trunc_sem u.f.f_trunc_sem
@@ -319,7 +317,7 @@ int ll_xattr_cache_get(struct inode *inode,* Locking to guarantee consistency of non-atomic updates to long long i_size, * consistency between file size and KMS. * -* Implemented by ->lli_size_sem and ->lsm_lock, nested in that order. +* Implemented by ->lli_size_mutex and ->lsm_lock, nested in that order. */ void ll_inode_size_lock (struct inode *inode);
@@ -1448,7 +1446,7 @@ static inline void cl_isize_unlock(struct inode *inode)static inline void cl_isize_write_nolock (struct inode *inode,loff_t kms) { -LASSERT (down_trylock (&ll_i2info (inode)->lli_size_sem) !=0 ); +LASSERT (mutex_is_locked (&ll_i2info (inode)->lli_size_mutex));i_size_write (inode, kms); }
drivers/staging/lustre/lustre/llite/llite_lib.c +3 -9
@@ -982,8 +982,7 @@ void ll_lli_init(struct ll_inode_info *lli)spin_lock_init (&lli->lli_sa_lock); lli->lli_opendir_pid =0 ; }else { -sema_init (&lli->lli_size_sem,1 ); - lli->lli_size_sem_owner =NULL ; +mutex_init (&lli->lli_size_mutex); lli->lli_symlink_name =NULL ;init_rwsem (&lli->lli_trunc_sem);mutex_init (&lli->lli_write_mutex);
@@ -1700,10 +1699,7 @@ void ll_inode_size_lock(struct inode *inode)LASSERT (!S_ISDIR (inode->i_mode)); lli =ll_i2info (inode); -LASSERT (lli->lli_size_sem_owner != current); -down (&lli->lli_size_sem); -LASSERT (lli->lli_size_sem_owner ==NULL ); - lli->lli_size_sem_owner = current; +mutex_lock (&lli->lli_size_mutex); }void ll_inode_size_unlock (struct inode *inode)
@@ -1711,9 +1707,7 @@ void ll_inode_size_unlock(struct inode *inode)struct ll_inode_info *lli; lli =ll_i2info (inode); -LASSERT (lli->lli_size_sem_owner == current); - lli->lli_size_sem_owner =NULL ; -up (&lli->lli_size_sem); +mutex_unlock (&lli->lli_size_mutex); }void ll_update_inode (struct inode *inode,struct lustre_md *md)
Signature · 1 line
1.8.5.3
PATCH 37/47 staging/lustre/llite: Do not rate limit dirty page discard warning
In reply to Oleg DrokinFrom: Ryan Haasken <[email protected]>
Messages which are printed by ll_dirty_page_discard_warn() should not be rate limited. If they are rate limited, some files which may be corrupted on client eviction will not be reported to the user.
This patch changes the CWARN to a CDEBUG to disable console message rate limiting for this message. The dirty page discard warnings are already limited on a per-file basis by the function vvp_vmpage_error which calls ll_dirty_page_discard_warn only if the ccc_object's cob_discard_page_warned == 0.
Reviewed-on: http://review.whamcloud.com/9752
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4799
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +6 -5
@@ -2456,11 +2456,12 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret) path =ll_d_path (dentry, buf,PAGE_SIZE ); } -CWARN ("%s: dirty page discard: %s/fid: " DFID "/%s may get corrupted " -"(rc %d)\n" ,ll_get_fsname (page->mapping->host->i_sb,NULL ,0 ), -s2lsi (page->mapping->host->i_sb)->lsi_lmd->lmd_dev, -PFID (&obj->cob_header.coh_lu.loh_fid), - (path && !IS_ERR (path)) ? path :"" , ioret); +CDEBUG (D_WARNING , +"%s: dirty page discard: %s/fid: " DFID "/%s may get corrupted " +"(rc %d)\n" ,ll_get_fsname (page->mapping->host->i_sb,NULL ,0 ), +s2lsi (page->mapping->host->i_sb)->lsi_lmd->lmd_dev, +PFID (&obj->cob_header.coh_lu.loh_fid), + (path && !IS_ERR (path)) ? path :"" , ioret);if (dentry !=NULL )dput (dentry);
Signature · 1 line
1.8.5.3
PATCH 38/47 staging/lustre/lloop: avoid panic during blockdev_info
In reply to Oleg DrokinFrom: Bob Glossman <[email protected]>
Change the LL_IOC_LLOOP_INFO ioctl in the lustre lloop device driver to return an error instead of causing panics with LASSERT().
Reviewed-on: http://review.whamcloud.com/9888
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4863
--- drivers/staging/lustre/lustre/llite/lloop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/lloop.c +4 -1
@@ -624,7 +624,10 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,case LL_IOC_LLOOP_INFO : {struct lu_fid fid; -LASSERT (lo->lo_backing_file !=NULL ); +if (lo->lo_backing_file ==NULL ) { + err = -ENOENT ; +break ; + }if (inode ==NULL ) inode = lo->lo_backing_file->f_dentry->d_inode;if (lo->lo_state ==LLOOP_BOUND )
Signature · 1 line
1.8.5.3
PATCH 39/47 staging/lustre/clio: Solve a race in cl_lock_put
In reply to Oleg DrokinFrom: Jinshan Xiong <[email protected]>
It's not atomic to check the last reference and state of cl_lock in cl_lock_put(). This can cause a problem that an using lock is freed, if the process is preempted between atomic_dec_and_test() and (lock->cll_state == CLS_FREEING).
This problem can be solved by holding a refcount by coh_locks. In this case, it can be sure that if the lock refcount reaches zero, nobody else can have any chance to use it again.
Reviewed-on: http://review.whamcloud.com/9881
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4558
--- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/cl_lock.c +9 -1
@@ -533,6 +533,7 @@ static struct cl_lock *cl_lock_find(const struct lu_env *env,spin_lock (&head->coh_lock_guard); ghost =cl_lock_lookup (env, obj, io, need);if (ghost ==NULL ) { +cl_lock_get_trust (lock);list_add_tail (&lock->cll_linkage, &head->coh_locks);spin_unlock (&head->coh_lock_guard);
@@ -791,15 +792,22 @@ static void cl_lock_delete0(const struct lu_env *env, struct cl_lock *lock)LINVRNT (cl_lock_invariant (env, lock));if (lock->cll_state <CLS_FREEING ) { +bool in_cache; +LASSERT (lock->cll_state !=CLS_INTRANSIT );cl_lock_state_set (env, lock,CLS_FREEING ); head =cl_object_header (lock->cll_descr.cld_obj);spin_lock (&head->coh_lock_guard); -list_del_init (&lock->cll_linkage); + in_cache = !list_empty (&lock->cll_linkage); +if (in_cache) +list_del_init (&lock->cll_linkage);spin_unlock (&head->coh_lock_guard); +if (in_cache)/* coh_locks cache holds a refcount. */ +cl_lock_put (env, lock); +/* * From now on, no new references to this lock can be acquired * by cl_lock_lookup().
Signature · 1 line
1.8.5.3
PATCH 40/47 staging/lustre/mdc: use cl_max_mds_md to pack getattr RPC
In reply to Oleg DrokinFrom: wang di <[email protected]>
In some cases, cl_default_mds_easize might be zero, especially for MDC connected to non-MDT0, then mdc might pack getattr RPC with zero eadatasize.
If client is trying to access remote striped directory with zero eadatasize, MDT will not return layout information of the striped direcotry, which will be mis-regarded as non-striped directory.
So we should use cl_max_mds_easize if cl_default_mds_easize is zero.
Reviewed-on: http://review.whamcloud.com/9862
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4847
--- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_locks.c +8 -4
@@ -462,6 +462,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, OBD_MD_FLRMTPERM : OBD_MD_FLACL);struct ldlm_intent *lit;int rc; +int easize; req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_LDLM_INTENT_GETATTR );
@@ -482,12 +483,15 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, lit =req_capsule_client_get (&req->rq_pill, &RMF_LDLM_INTENT ); lit->opc = (__u64 )it->it_op; +if (obddev->u.cli.cl_default_mds_easize >0 ) + easize = obddev->u.cli.cl_default_mds_easize; +else + easize = obddev->u.cli.cl_max_mds_easize; +/* pack the intended request */ -mdc_getattr_pack (req, valid, it->it_flags, op_data, - obddev->u.cli.cl_default_mds_easize); +mdc_getattr_pack (req, valid, it->it_flags, op_data, easize); -req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , - obddev->u.cli.cl_default_mds_easize); +req_capsule_set_size (&req->rq_pill, &RMF_MDT_MD ,RCL_SERVER , easize);if (client_is_remote (exp))req_capsule_set_size (&req->rq_pill, &RMF_ACL ,RCL_SERVER ,sizeof (struct mdt_remote_perm ));
Signature · 1 line
1.8.5.3
PATCH 41/47 staging/lustre/llite: remove dead code
In reply to Oleg DrokinFrom: "John L. Hammond" <[email protected]>
In llite remove unused declarations, parameters, types, and unused, get-only, or set-only structure members. Add static and const qualifiers to declarations where possible.
Reviewed-on: http://review.whamcloud.com/9767
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
--- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 +- drivers/staging/lustre/lustre/llite/dcache.c | 26 ++-- drivers/staging/lustre/lustre/llite/dir.c | 8 +- drivers/staging/lustre/lustre/llite/file.c | 89 ++++++------- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 138 ++++----------------- drivers/staging/lustre/lustre/llite/llite_lib.c | 64 +--------- drivers/staging/lustre/lustre/llite/llite_mmap.c | 23 +--- drivers/staging/lustre/lustre/llite/lloop.c | 5 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/llite/namei.c | 40 ++---- drivers/staging/lustre/lustre/llite/remote_perm.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 7 -- drivers/staging/lustre/lustre/llite/rw26.c | 15 +-- drivers/staging/lustre/lustre/llite/statahead.c | 8 -- drivers/staging/lustre/lustre/llite/super25.c | 7 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 +- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 4 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- 21 files changed, 125 insertions(+), 335 deletions(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +2 -2
@@ -63,7 +63,7 @@#include "../llite/llite_internal.h" -const struct cl_req_operations ccc_req_ops; +static const struct cl_req_operations ccc_req_ops;/* * ccc_ prefix stands for "Common Client Code".
@@ -962,7 +962,7 @@ void ccc_req_attr_set(const struct lu_env *env, JOBSTATS_JOBID_SIZE); } -const struct cl_req_operations ccc_req_ops = { +static const struct cl_req_operations ccc_req_ops = { .cro_attr_set = ccc_req_attr_set, .cro_completion = ccc_req_completion };
drivers/staging/lustre/lustre/llite/dcache.c +9 -17
@@ -69,8 +69,7 @@ static void ll_release(struct dentry *de)ll_intent_release (lld->lld_it);OBD_FREE (lld->lld_it,sizeof (*lld->lld_it)); } -LASSERT (lld->lld_cwd_count ==0 ); -LASSERT (lld->lld_mnt_count ==0 ); + de->d_fsdata =NULL ;call_rcu (&lld->lld_rcu_head, free_dentry_data); }
@@ -82,8 +81,9 @@ static void ll_release(struct dentry *de)* an AST before calling d_revalidate_it(). The dentry still exists (marked * INVALID) so d_lookup() matches it, but we have no lock on it (so * lock_match() fails) and we spin around real_lookup(). */ -int ll_dcompare (const struct dentry *parent,const struct dentry *dentry, -unsigned int len,const char *str,const struct qstr *name) +static int ll_dcompare (const struct dentry *parent,const struct dentry *dentry, +unsigned int len,const char *str, +const struct qstr *name) {if (len != name->len)return 1 ;
@@ -238,7 +238,8 @@ void ll_intent_release(struct lookup_intent *it)ll_intent_drop_lock (it);/* We are still holding extra reference on a request, need to free it */ if (it_disposition (it,DISP_ENQ_OPEN_REF )) -ptlrpc_req_finished (it->d.lustre.it_data);/* ll_file_open */ +ptlrpc_req_finished (it->d.lustre.it_data);/* ll_file_open */ +if (it_disposition (it,DISP_ENQ_CREATE_REF ))/* create rec */ ptlrpc_req_finished (it->d.lustre.it_data);
@@ -316,15 +317,6 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry) } } -void ll_frob_intent (struct lookup_intent **itp,struct lookup_intent *deft) -{ -struct lookup_intent *it = *itp; - -if (!it || it->it_op ==IT_GETXATTR ) - it = *itp = deft; - -} -static int ll_revalidate_dentry (struct dentry *dentry,unsigned int lookup_flags) {
@@ -356,7 +348,7 @@ static int ll_revalidate_dentry(struct dentry *dentry,/* * Always trust cached dentries. Update statahead window if necessary. */ -int ll_revalidate_nd (struct dentry *dentry,unsigned int flags) +static int ll_revalidate_nd (struct dentry *dentry,unsigned int flags) {int rc;
@@ -368,7 +360,7 @@ int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) } -void ll_d_iput (struct dentry *de,struct inode *inode) +static void ll_d_iput (struct dentry *de,struct inode *inode) {LASSERT (inode);if (!find_cbdata (inode))
@@ -376,7 +368,7 @@ void ll_d_iput(struct dentry *de, struct inode *inode)iput (inode); } -struct dentry_operations ll_d_ops = { +const struct dentry_operations ll_d_ops = { .d_revalidate = ll_revalidate_nd, .d_release = ll_release, .d_delete = ll_ddelete,
drivers/staging/lustre/lustre/llite/dir.c +4 -4
@@ -632,7 +632,7 @@ out:return rc; } -int ll_send_mgc_param (struct obd_export *mgc,char *string) +static int ll_send_mgc_param (struct obd_export *mgc,char *string) {struct mgs_send_param *msp;int rc =0 ;
@@ -1964,17 +1964,17 @@ out:return ret; } -int ll_dir_open (struct inode *inode,struct file *file) +static int ll_dir_open (struct inode *inode,struct file *file) {return ll_file_open (inode, file); } -int ll_dir_release (struct inode *inode,struct file *file) +static int ll_dir_release (struct inode *inode,struct file *file) {return ll_file_release (inode, file); } -struct file_operations ll_dir_operations = { +const struct file_operations ll_dir_operations = { .llseek = ll_dir_seek, .open = ll_dir_open, .release = ll_dir_release,
drivers/staging/lustre/lustre/llite/file.c +46 -43
225 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_capa.c +3 -1
@@ -68,6 +68,8 @@ static unsigned long long ll_capa_renewal_noent = 0;static unsigned long long ll_capa_renewal_failed =0 ;static unsigned long long ll_capa_renewal_retries =0 ; +static int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa); +static inline void update_capa_timer (struct obd_capa *ocapa,cfs_time_t expiry) { if (cfs_time_before(expiry, ll_capa_timer.expires) ||
@@ -515,7 +517,7 @@ static inline void delay_capa_renew(struct obd_capa *oc, cfs_time_t delay) oc->c_expiry =cfs_time_add (oc->c_expiry,cfs_time_seconds (delay)); } -int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa) +static int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa) {struct inode *inode = ocapa->u.cli.inode;int rc =0 ;
drivers/staging/lustre/lustre/llite/llite_internal.h +21 -117
360 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_lib.c +5 -59
112 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_mmap.c +6 -17
@@ -51,10 +51,7 @@#include "llite_internal.h" #include <linux/lustre_compat25.h> -struct page *ll_nopage (struct vm_area_struct *vma,unsigned long address, -int *type); - -static struct vm_operations_struct ll_file_vm_ops; +static const struct vm_operations_struct ll_file_vm_ops; void policy_from_vma(ldlm_policy_data_t *policy, struct vm_area_struct *vma, unsigned long addr,
@@ -97,10 +94,10 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,* \retval EINVAL if env can't allocated * \return other error codes from cl_io_init. */ -struct cl_io *ll_fault_io_init (struct vm_area_struct *vma, -struct lu_env **env_ret, -struct cl_env_nest *nest, -pgoff_t index,unsigned long *ra_flags) +static struct cl_io * +ll_fault_io_init (struct vm_area_struct *vma,struct lu_env **env_ret, +struct cl_env_nest *nest,pgoff_t index, +unsigned long *ra_flags) {struct file *file = vma->vm_file;struct inode *inode = file->f_dentry->d_inode;
@@ -446,14 +443,6 @@ static void ll_vm_close(struct vm_area_struct *vma)LASSERT (atomic_read (&vob->cob_mmap_cnt) >=0 ); } - -/* return the user space pointer that maps to a file offset via a vma */ -static inline unsigned long file_to_user (struct vm_area_struct *vma,__u64 byte) -{ -return vma->vm_start + (byte - ((__u64 )vma->vm_pgoff <<PAGE_CACHE_SHIFT )); - -} -/* XXX put nice comment here. talk about __free_pte -> dirty pages and * nopage's reference passing to the pte */ int ll_teardown_mmaps (struct address_space *mapping,__u64 first,__u64 last)
@@ -470,7 +459,7 @@ int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last)return rc; } -static struct vm_operations_struct ll_file_vm_ops = { +static const struct vm_operations_struct ll_file_vm_ops = { .fault = ll_fault, .page_mkwrite = ll_page_mkwrite, .open = ll_vm_open,
drivers/staging/lustre/lustre/llite/lloop.c +0 -5
@@ -122,9 +122,6 @@ struct lloop_device {loff_t lo_offset;loff_t lo_sizelimit;int lo_flags; -int (*ioctl)(struct lloop_device *,int cmd, -unsigned long arg); -struct file *lo_backing_file;struct block_device *lo_device;unsigned lo_blocksize;
@@ -509,7 +506,6 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, lo->lo_device = bdev; lo->lo_flags = lo_flags; lo->lo_backing_file = file; - lo->ioctl =NULL ; lo->lo_sizelimit =0 ; lo->old_gfp_mask =mapping_gfp_mask (mapping);mapping_set_gfp_mask (mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
@@ -568,7 +564,6 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,down (&lo->lo_sem); lo->lo_backing_file =NULL ; - lo->ioctl =NULL ; lo->lo_device =NULL ; lo->lo_offset =0 ; lo->lo_sizelimit =0 ;
drivers/staging/lustre/lustre/llite/lproc_llite.c +2 -2
@@ -41,9 +41,9 @@#include <obd_support.h> #include "llite_internal.h" +#include "vvp_internal.h" /* /proc/lustre/llite mount point registration */ -extern struct file_operations vvp_dump_pgcache_file_ops;static struct file_operations ll_rw_extents_stats_fops;static struct file_operations ll_rw_extents_stats_pp_fops;static struct file_operations ll_rw_offset_stats_fops;
@@ -837,7 +837,7 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {#define MAX_STRING_SIZE 128 -struct llite_file_opcode { +static const struct llite_file_opcode { __u32 opcode; __u32 type; const char *opname;
drivers/staging/lustre/lustre/llite/namei.c +10 -30
@@ -75,14 +75,6 @@ static int ll_d_mountpoint(struct dentry *dparent, struct dentry *dchild,return mounted; } -int ll_unlock (__u32 mode,struct lustre_handle *lockh) -{ -ldlm_lock_decref (lockh, mode); - -return 0 ; -} - -/* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ static int ll_test_inode (struct inode *inode,void *opaque) {
@@ -433,12 +425,10 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)return de; } -int ll_lookup_it_finish (struct ptlrpc_request *request, -struct lookup_intent *it,void *data) +static int ll_lookup_it_finish (struct ptlrpc_request *request, +struct lookup_intent *it, +struct inode *parent,struct dentry **de) { -struct it_cb_data *icbd = data; -struct dentry **de = icbd->icbd_childp; -struct inode *parent = icbd->icbd_parent;struct inode *inode =NULL ;__u64 bits =0 ;int rc;
@@ -513,7 +503,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,struct dentry *save = dentry, *retval;struct ptlrpc_request *req =NULL ;struct md_op_data *op_data; -struct it_cb_data icbd;__u32 opc;int rc;
@@ -527,7 +516,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,if (d_mountpoint (dentry))CERROR ("Tell Peter, lookup on mtpt, it %s\n" ,LL_IT2STR (it)); -ll_frob_intent (&it, &lookup_it); +if (it ==NULL || it->it_op ==IT_GETXATTR ) + it = &lookup_it;if (it->it_op ==IT_GETATTR ) { rc =ll_statahead_enter (parent, &dentry,0 );
@@ -538,9 +528,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, } } - icbd.icbd_childp = &dentry; - icbd.icbd_parent = parent; -if (it->it_op &IT_CREAT ) opc =LUSTRE_OPC_CREATE ;else
@@ -562,7 +549,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,if (rc <0 )GOTO (out, retval =ERR_PTR (rc)); - rc =ll_lookup_it_finish (req, it, &icbd); + rc =ll_lookup_it_finish (req, it, parent, &dentry);if (rc !=0 ) {ll_intent_release (it);GOTO (out, retval =ERR_PTR (rc));
@@ -697,10 +684,7 @@ out_release:/* We depend on "mode" being set with the proper file type/umask by now */ -static struct inode *ll_create_node (struct inode *dir,const char *name, -int namelen,const void *data,int datalen, -int mode,__u64 extra, -struct lookup_intent *it) +static struct inode *ll_create_node (struct inode *dir,struct lookup_intent *it) {struct inode *inode =NULL ;struct ptlrpc_request *request =NULL ;
@@ -757,14 +741,10 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,if (rc)return rc; - inode =ll_create_node (dir, dentry->d_name.name, dentry->d_name.len, -NULL ,0 , mode,0 , it); + inode =ll_create_node (dir, it);if (IS_ERR (inode))return PTR_ERR (inode); -if (filename_is_volatile (dentry->d_name.name, dentry->d_name.len,NULL )) -ll_i2info (inode)->lli_volatile = true; -d_instantiate (dentry, inode);return 0 ; }
@@ -1238,7 +1218,7 @@ static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,return err; } -struct inode_operations ll_dir_inode_operations = { +const struct inode_operations ll_dir_inode_operations = { .mknod = ll_mknod, .atomic_open = ll_atomic_open, .lookup = ll_lookup_nd,
@@ -1260,7 +1240,7 @@ struct inode_operations ll_dir_inode_operations = { .get_acl = ll_get_acl, }; -struct inode_operations ll_special_inode_operations = { +const struct inode_operations ll_special_inode_operations = { .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission,
drivers/staging/lustre/lustre/llite/remote_perm.c +1 -1
@@ -77,7 +77,7 @@ static inline void free_ll_remote_perm(struct ll_remote_perm *lrp)OBD_SLAB_FREE (lrp, ll_remote_perm_cachep,sizeof (*lrp)); } -struct hlist_head *alloc_rmtperm_hash (void ) +static struct hlist_head *alloc_rmtperm_hash (void ) {struct hlist_head *hash;int i;
drivers/staging/lustre/lustre/llite/rw.c +0 -7
@@ -77,12 +77,6 @@ static void ll_cl_fini(struct ll_cl_context *lcc)cl_page_put (env, page); } -if (io && lcc->lcc_created) { -cl_io_end (env, io); -cl_io_unlock (env, io); -cl_io_iter_fini (env, io); -cl_io_fini (env, io); - }cl_env_put (env, &lcc->lcc_refcheck); }
@@ -167,7 +161,6 @@ static struct ll_cl_context *ll_cl_init(struct file *file, } }else result = io->ci_result; - lcc->lcc_created =1 ; } lcc->lcc_io = io;
drivers/staging/lustre/lustre/llite/rw26.c +6 -9
@@ -529,9 +529,9 @@ static int ll_write_end(struct file *file, struct address_space *mapping, }#ifdef CONFIG_MIGRATION -int ll_migratepage (struct address_space *mapping, -struct page *newpage,struct page *page - ,enum migrate_mode mode +static int ll_migratepage (struct address_space *mapping, +struct page *newpage,struct page *page, +enum migrate_mode mode ) {/* Always fail page migration until we have a proper implementation */
@@ -540,9 +540,8 @@ int ll_migratepage(struct address_space *mapping,#endif #ifndef MS_HAS_NEW_AOPS -struct address_space_operations ll_aops = { - .readpage = ll_readpage, -// .readpages = ll_readpages, +const struct address_space_operations ll_aops = { + .readpage = ll_readpage, .direct_IO = ll_direct_IO_26, .writepage = ll_writepage, .writepages = ll_writepages,
@@ -554,10 +553,9 @@ struct address_space_operations ll_aops = {#ifdef CONFIG_MIGRATION .migratepage = ll_migratepage, #endif - .bmap =NULL };#else -struct address_space_operations_ext ll_aops = { +const struct address_space_operations_ext ll_aops = { .orig_aops.readpage = ll_readpage,// .orig_aops.readpages = ll_readpages, .orig_aops.direct_IO = ll_direct_IO_26,
@@ -571,7 +569,6 @@ struct address_space_operations_ext ll_aops = {#ifdef CONFIG_MIGRATION .orig_aops.migratepage = ll_migratepage, #endif - .orig_aops.bmap = NULL, .write_begin = ll_write_begin, .write_end = ll_write_end };
drivers/staging/lustre/lustre/llite/statahead.c +0 -8
@@ -1230,9 +1230,7 @@ do_it:*/ ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); - sai->sai_in_readpage =1 ; page =ll_get_dir_page (dir, pos, &chain); - sai->sai_in_readpage =0 ; }else {LASSERT (le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE );ll_release_page (page,1 );
@@ -1563,12 +1561,6 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,return entry ?1 : -EAGAIN ; } -/* if statahead is busy in readdir, help it do post-work */ -while (!ll_sa_entry_stated (entry) && - sai->sai_in_readpage && - !sa_received_empty (sai)) -ll_post_statahead (sai); -if (!ll_sa_entry_stated (entry)) { sai->sai_index_wait = entry->se_index; lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,
drivers/staging/lustre/lustre/llite/super25.c +2 -5
@@ -72,7 +72,7 @@ static void ll_destroy_inode(struct inode *inode)call_rcu (&inode->i_rcu, ll_inode_destroy_callback); } -int ll_init_inodecache (void ) +static int ll_init_inodecache (void ) { ll_inode_cachep = kmem_cache_create("lustre_inode_cache", sizeof(struct ll_inode_info),
@@ -82,7 +82,7 @@ int ll_init_inodecache(void)return 0 ; } -void ll_destroy_inodecache (void ) +static void ll_destroy_inodecache (void ) {kmem_cache_destroy (ll_inode_cachep); }
@@ -103,9 +103,6 @@ MODULE_ALIAS_FS("lustre");void lustre_register_client_process_config (int (*cpc)(struct lustre_cfg *lcfg)); -int vvp_global_init (void ); -void vvp_global_fini (void ); -static int __init init_lustre_lite (void ) {int i, rc, seed[2 ];
drivers/staging/lustre/lustre/llite/vvp_dev.c +3 -3
@@ -43,7 +43,7 @@#include <obd.h> #include <lustre_lite.h> - +#include "llite_internal.h" #include "vvp_internal.h" /*****************************************************************************
@@ -57,7 +57,7 @@* "llite_" (var. "ll_") prefix. */ -struct kmem_cache *vvp_thread_kmem; +static struct kmem_cache *vvp_thread_kmem;static struct kmem_cache *vvp_session_kmem;static struct lu_kmem_descr vvp_caches[] = { {
@@ -536,7 +536,7 @@ static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp)return result; } -struct file_operations vvp_dump_pgcache_file_ops = { +const struct file_operations vvp_dump_pgcache_file_ops = { .owner =THIS_MODULE , .open = vvp_dump_pgcache_seq_open, .read = seq_read,
drivers/staging/lustre/lustre/llite/vvp_internal.h +1 -1
@@ -57,6 +57,6 @@ struct lu_object *vvp_object_alloc(const struct lu_env *env,struct ccc_object *cl_inode2ccc (struct inode *inode); -extern struct kmem_cache *vvp_thread_kmem; +extern const struct file_operations vvp_dump_pgcache_file_ops;#endif /* VVP_INTERNAL_H */
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -1
@@ -190,7 +190,7 @@ static void vvp_io_fault_fini(const struct lu_env *env,vvp_io_fini (env, ios); } -enum cl_lock_mode vvp_mode_from_vma (struct vm_area_struct *vma) +static enum cl_lock_mode vvp_mode_from_vma (struct vm_area_struct *vma) {/* * we only want to hold PW locks if the mmap() can generate
drivers/staging/lustre/lustre/llite/vvp_object.c +2 -2
@@ -120,8 +120,8 @@ static int vvp_attr_set(const struct lu_env *env, struct cl_object *obj,return 0 ; } -int vvp_conf_set (const struct lu_env *env,struct cl_object *obj, -const struct cl_object_conf *conf) +static int vvp_conf_set (const struct lu_env *env,struct cl_object *obj, +const struct cl_object_conf *conf) {struct ll_inode_info *lli =ll_i2info (conf->coc_inode);
drivers/staging/lustre/lustre/llite/xattr_cache.c +1 -1
@@ -232,7 +232,7 @@ static int ll_xattr_cache_list(struct list_head *cache,* \retval 0 @cache is not initialized * \retval 1 @cache is initialized */ -int ll_xattr_cache_valid (struct ll_inode_info *lli) +static int ll_xattr_cache_valid (struct ll_inode_info *lli) {return !!(lli->lli_flags &LLIF_XATTR_CACHE ); }
Signature · 1 line
1.8.5.3
Re: [PATCH 41/47] staging/lustre/llite: remove dead code
Quoted 6 lines · Oleg Drokin
From: "John L. Hammond" <[email protected]>
In llite remove unused declarations, parameters, types, and unused, get-only, or set-only structure members. Add static and const qualifiers to declarations where possible.
Quoted 6 lines
Signed-off-by John L. Hammond <[email protected]>Reviewed-on: http://review.whamcloud.com/9767
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675Reviewed-by Lai Siyao <[email protected]>Reviewed-by Jinshan Xiong <[email protected]>Signed-off-by Oleg Drokin <[email protected]>
This is a random grab bag of changes to lots of files. One thing per patch, etc, next time.
drivers/staging/lustre/lustre/llite/dcache.c static void ll_release(struct dentry *de) · line 72
Quoted 11 lines
drivers/staging/lustre/lustre/llite/dcache.c +1
-2@@ -69,8 +69,7 @@ static void ll_release(struct dentry *de)ll_intent_release (lld->lld_it);OBD_FREE (lld->lld_it,sizeof (*lld->lld_it)); } -LASSERT (lld->lld_cwd_count ==0 ); -LASSERT (lld->lld_mnt_count ==0 ); +
I'm totally in favour of removing LASSERT() calls... But is this a "set only" struct member? It's totally unclear from the patch description.
Quoted 17 lines
drivers/staging/lustre/lustre/llite/statahead.c +0
-2@@ -1230,9 +1230,7 @@ do_it:*/ ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); - sai->sai_in_readpage =1 ; page =ll_get_dir_page (dir, pos, &chain); - sai->sai_in_readpage =0 ; }else {LASSERT (le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE );ll_release_page (page,1 );@@ -1563,12 +1561,6 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,return entry ?1 : -EAGAIN ; }
drivers/staging/lustre/lustre/llite/statahead.c int do_statahead_enter(struct inode *dir, struct dentry **dentryp, · line 1566
Quoted 10 lines
drivers/staging/lustre/lustre/llite/statahead.c +0
-6-/* if statahead is busy in readdir, help it do post-work */ -while (!ll_sa_entry_stated (entry) && - sai->sai_in_readpage && - !sa_received_empty (sai)) -ll_post_statahead (sai); -if (!ll_sa_entry_stated (entry)) { sai->sai_index_wait = entry->se_index; lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,
What is this change about really? I've already waded through 1271 lines of random changes at this point and now I have to figure out what ll_post_statahead() does and why we don't need to call it now?
Anyways, please explain this change.
Btw, it's very easy to break up a patch into separate patches. Use git citool. Highlight the lines of code which make things static. Right click and select "Add highlighted lines to commit." This patch has three Reviewed-by tags so you guys need to be pushing back on this kind of stuff, it's obviously outside of the "one thing per patch" rule.
regards,
dan carpenter
RE: [PATCH 41/47] staging/lustre/llite: remove dead code
Quoted 15 lines
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Tuesday, April 29, 2014 6:03 AM
To: Oleg Drokin
Cc: Greg Kroah-Hartman; [email protected]; [email protected]; Drokin, Oleg; Hammond, John
Subject: Re: [PATCH 41/47] staging/lustre/llite: remove dead codeQuoted 6 lines · Oleg Drokin
From: "John L. Hammond" <[email protected]>
In llite remove unused declarations, parameters, types, and unused, get-only, or set-only structure members. Add static and const qualifiers to declarations where possible.
...
Quoted 3 lines
This is a random grab bag of changes to lots of files. One thing per patch, etc, next time.
OK, granted. But some guidance would be welcome here. For clean-up work like this, do you want a patch that const-corrects one function, a patch that const corrects all functions in a file, or a patch that const corrects all functions in a module? Is it OK to do const and static correction in the same change? Is it OK to do const, static, and dead-code in a single file?
Quoted 16 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/staging/lustre/lustre/llite/dcache.cdrivers/staging/lustre/lustre/llite/dcache.c static void ll_release(struct dentry *de) · line 72
Quoted 10 lines
index 8b55080..7d520d8 100644
drivers/staging/lustre/lustre/llite/dcache.c +1
-2@@ -69,8 +69,7 @@ static void ll_release(struct dentry *de)ll_intent_release (lld->lld_it);OBD_FREE (lld->lld_it,sizeof (*lld->lld_it)); } -LASSERT (lld->lld_cwd_count ==0 ); -LASSERT (lld->lld_mnt_count ==0 ); +I'm totally in favour of removing
LASSERT()calls... But is this a "set only" struct member? It's totally unclear from the patch description.
Actually it's get only. I can label what's what in the commit messages.
Quoted 34 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/staging/lustre/lustre/llite/statahead.cdrivers/staging/lustre/lustre/llite/statahead.c int do_statahead_enter(struct inode *dir, struct
Quoted 14 lines
index 51c5327..1b47774 100644
drivers/staging/lustre/lustre/llite/statahead.c +0
-2@@ -1230,9 +1230,7 @@ do_it:*/ ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); - sai->sai_in_readpage =1 ; page =ll_get_dir_page (dir, pos, &chain); - sai->sai_in_readpage =0 ; }else {LASSERT (le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE );ll_release_page (page,1 );@@ -1563,12 +1561,6 @@ int do_statahead_enter(struct inode *dir, structdentry **dentryp,
drivers/staging/lustre/lustre/llite/statahead.c int do_statahead_enter(struct inode *dir, struct dentry **dentryp, · line 1566
Quoted 12 lines
drivers/staging/lustre/lustre/llite/statahead.c +0
-6return entry ?1 : -EAGAIN ; } -/* if statahead is busy in readdir, help it do post-work */ -while (!ll_sa_entry_stated (entry) && - sai->sai_in_readpage && - !sa_received_empty (sai)) -ll_post_statahead (sai); -if (!ll_sa_entry_stated (entry)) { sai->sai_index_wait = entry->se_index; lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,What is this change about really? I've already waded through 1271 lines of random changes at this point and now I have to figure out what
ll_post_statahead()does and why we don't need to call it now?
Quoted 1 line
Anyways, please explain this change.
It looks like this change got squished together with something else when it was pushed to staging. I've asked to Oleg check. In the original change, sai_in_readpage was never set. Hence it was easy to see that the if statement was dead code. Sorry for the confusion.
Best,
John
Re: [PATCH 41/47] staging/lustre/llite: remove dead code
Quoted 15 lines · John
Quoted 8 lines
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Tuesday, April 29, 2014 6:03 AM
To: Oleg Drokin
Cc: Greg Kroah-Hartman; [email protected]; [email protected]; Drokin, Oleg; Hammond, John
Subject: Re: [PATCH 41/47] staging/lustre/llite: remove dead codeQuoted 7 lines
Quoted 6 lines · Oleg Drokin
From: "John L. Hammond" <[email protected]>
In llite remove unused declarations, parameters, types, and unused, get-only, or set-only structure members. Add static and const qualifiers to declarations where possible.
Quoted 6 lines
...
Quoted 3 lines
This is a random grab bag of changes to lots of files. One thing per patch, etc, next time.
OK, granted. But some guidance would be welcome here.
No problem. This is something a lot of people have questions about.
Quoted 4 lines
For
clean-up work like this, do you want a patch that const-corrects one function, a patch that const corrects all functions in a file, or a patch that const corrects all functions in a module?
All the functions in the module is fine.
Quoted 1 line
Is it OK to do const and static correction in the same change?
That's a borderline case. My first instinct is to say no.
Are we talking about a single variable and making it const in one patch and then const static in the next? That's obviously better done as one change. But if you're talking about different variables, then maybe it's better as two changes. But then maybe some variables should be made into "static const" and some should be just "static".
These things depend on how you sell it.
[patch] staging: lustre/llite: tighten up static and const declarations
That would be ok probably.
Quoted 1 line
Is it OK to do const, static, and dead-code in a single file?
No.
Greg compile tests patches but I normally don't. When I review +static patches then I pipe it to a command that strips out all the +static changes and I verify that nothing else changed. When I review dead code patches I scan it for places which add code and look at why it does that. Then I quickly rescan to verify that the dead code really is dead. Normally I can tell just from looking at the patch because there is an "#if 0" but if it's something more complicated then hopefully it's explained in the changelog. If you mix the two kinds of changes then it messes up my review process.
regards,
dan carpenter
Re: [PATCH 41/47] staging/lustre/llite: remove dead code
In reply to Dan CarpenterHello!
Quoted 32 lines · Dan Carpenter
Quoted 17 lines
drivers/staging/lustre/lustre/llite/statahead.c +0
-2@@ -1230,9 +1230,7 @@ do_it:*/ ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); - sai->sai_in_readpage =1 ; page =ll_get_dir_page (dir, pos, &chain); - sai->sai_in_readpage =0 ; }else {LASSERT (le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE );ll_release_page (page,1 );@@ -1563,12 +1561,6 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,return entry ?1 : -EAGAIN ; }drivers/staging/lustre/lustre/llite/statahead.c int do_statahead_enter(struct inode *dir, struct dentry **dentryp, · line 1566
Quoted 10 lines
drivers/staging/lustre/lustre/llite/statahead.c +0
-6-/* if statahead is busy in readdir, help it do post-work */ -while (!ll_sa_entry_stated (entry) && - sai->sai_in_readpage && - !sa_received_empty (sai)) -ll_post_statahead (sai); -if (!ll_sa_entry_stated (entry)) { sai->sai_index_wait = entry->se_index; lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,What is this change about really? I've already waded through 1271 lines of random changes at this point and now I have to figure out what
ll_post_statahead()does and why we don't need to call it now?
Quoted 1 line
Anyways, please explain this change.
Ok, so after some digging.
The first hunk of the above was gone in our code with the move of a lot of directory processing down onto mdc layer as part of support for multiple metadata servers (a new feature). Then the second hunk was the cleanup sine nobody was setting the sai_in_readpage ever.
sai_in_readpage in itself originally was devised as performance optimization for the case where the statahead thread is waiting for READDIR RPC to return while there are already some GETATTR RPCs that have already returned and are waiting to be interpreted.
This does not affect correctness in any way, though. And removing it brings the code closer to our current tree which is hopefully a good thing.
I can rediff this patch with this particular part dropped if there are any concerns and it's possible to reintegrate it in a changed form.
Bye,
Oleg
Re: [PATCH 41/47] staging/lustre/llite: remove dead code
Quoted 2 lines · Oleg Drokin
I can rediff this patch with this particular part dropped if there are any concerns and it's possible to reintegrate it in a changed form.
No no. I knew that Greg had already merged this stuff by the time I got around to reviewing it. It was just some bonus grumbling after the fact.
regards,
dan carpenter
Re: [PATCH 41/47] staging/lustre/llite: remove dead code
In reply to Oleg DrokinQuoted 5 lines · Oleg Drokin
From: "John L. Hammond" <[email protected]>
In llite remove unused declarations, parameters, types, and unused, get-only, or set-only structure members. Add static and const qualifiers to declarations where possible.
While we are here, does lustre really need all these exports?
rw@sandpuppy:~/linux (master $)> git grep EXPORT_SYMBOL drivers/staging/lustre | wc -l
1499
Some exports also have very generic names like the class_* stuff or at_max, at_min...
Quoted 1,413 lines
Signed-off-by John L. Hammond <[email protected]>Reviewed-on: http://review.whamcloud.com/9767
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675Reviewed-by Lai Siyao <[email protected]>Reviewed-by Jinshan Xiong <[email protected]>Signed-off-by Oleg Drokin <[email protected]>--- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 +- drivers/staging/lustre/lustre/llite/dcache.c | 26 ++-- drivers/staging/lustre/lustre/llite/dir.c | 8 +- drivers/staging/lustre/lustre/llite/file.c | 89 ++++++------- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 138 ++++----------------- drivers/staging/lustre/lustre/llite/llite_lib.c | 64 +--------- drivers/staging/lustre/lustre/llite/llite_mmap.c | 23 +--- drivers/staging/lustre/lustre/llite/lloop.c | 5 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/llite/namei.c | 40 ++---- drivers/staging/lustre/lustre/llite/remote_perm.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 7 -- drivers/staging/lustre/lustre/llite/rw26.c | 15 +-- drivers/staging/lustre/lustre/llite/statahead.c | 8 -- drivers/staging/lustre/lustre/llite/super25.c | 7 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 +- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 4 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- 21 files changed, 125 insertions(+), 335 deletions(-)drivers/staging/lustre/lustre/lclient/lcommon_cl.c +2
-2@@ -63,7 +63,7 @@#include "../llite/llite_internal.h" -const struct cl_req_operations ccc_req_ops; +static const struct cl_req_operations ccc_req_ops;/* * ccc_ prefix stands for "Common Client Code". @@ -962,7 +962,7 @@ void ccc_req_attr_set(const struct lu_env *env, JOBSTATS_JOBID_SIZE); } -const struct cl_req_operations ccc_req_ops = { +static const struct cl_req_operations ccc_req_ops = { .cro_attr_set = ccc_req_attr_set, .cro_completion = ccc_req_completion };drivers/staging/lustre/lustre/llite/dcache.c +9
-17@@ -69,8 +69,7 @@ static void ll_release(struct dentry *de)ll_intent_release (lld->lld_it);OBD_FREE (lld->lld_it,sizeof (*lld->lld_it)); } -LASSERT (lld->lld_cwd_count ==0 ); -LASSERT (lld->lld_mnt_count ==0 ); + de->d_fsdata =NULL ;call_rcu (&lld->lld_rcu_head, free_dentry_data); }@@ -82,8 +81,9 @@ static void ll_release(struct dentry *de)* an AST before calling d_revalidate_it(). The dentry still exists (marked * INVALID) so d_lookup() matches it, but we have no lock on it (so * lock_match() fails) and we spin around real_lookup(). */ -int ll_dcompare (const struct dentry *parent,const struct dentry *dentry, -unsigned int len,const char *str,const struct qstr *name) +static int ll_dcompare (const struct dentry *parent,const struct dentry *dentry, +unsigned int len,const char *str, +const struct qstr *name) {if (len != name->len)return 1 ;@@ -238,7 +238,8 @@ void ll_intent_release(struct lookup_intent *it)ll_intent_drop_lock (it);/* We are still holding extra reference on a request, need to free it */ if (it_disposition (it,DISP_ENQ_OPEN_REF )) -ptlrpc_req_finished (it->d.lustre.it_data);/* ll_file_open */ +ptlrpc_req_finished (it->d.lustre.it_data);/* ll_file_open */ +if (it_disposition (it,DISP_ENQ_CREATE_REF ))/* create rec */ ptlrpc_req_finished (it->d.lustre.it_data);@@ -316,15 +317,6 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry) } } -void ll_frob_intent (struct lookup_intent **itp,struct lookup_intent *deft) -{ -struct lookup_intent *it = *itp; - -if (!it || it->it_op ==IT_GETXATTR ) - it = *itp = deft; - -} -static int ll_revalidate_dentry (struct dentry *dentry,unsigned int lookup_flags) {@@ -356,7 +348,7 @@ static int ll_revalidate_dentry(struct dentry *dentry,/* * Always trust cached dentries. Update statahead window if necessary. */ -int ll_revalidate_nd (struct dentry *dentry,unsigned int flags) +static int ll_revalidate_nd (struct dentry *dentry,unsigned int flags) {int rc;@@ -368,7 +360,7 @@ int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) } -void ll_d_iput (struct dentry *de,struct inode *inode) +static void ll_d_iput (struct dentry *de,struct inode *inode) {LASSERT (inode);if (!find_cbdata (inode))@@ -376,7 +368,7 @@ void ll_d_iput(struct dentry *de, struct inode *inode)iput (inode); } -struct dentry_operations ll_d_ops = { +const struct dentry_operations ll_d_ops = { .d_revalidate = ll_revalidate_nd, .d_release = ll_release, .d_delete = ll_ddelete,drivers/staging/lustre/lustre/llite/dir.c +4
-4@@ -632,7 +632,7 @@ out:return rc; } -int ll_send_mgc_param (struct obd_export *mgc,char *string) +static int ll_send_mgc_param (struct obd_export *mgc,char *string) {struct mgs_send_param *msp;int rc =0 ;@@ -1964,17 +1964,17 @@ out:return ret; } -int ll_dir_open (struct inode *inode,struct file *file) +static int ll_dir_open (struct inode *inode,struct file *file) {return ll_file_open (inode, file); } -int ll_dir_release (struct inode *inode,struct file *file) +static int ll_dir_release (struct inode *inode,struct file *file) {return ll_file_release (inode, file); } -struct file_operations ll_dir_operations = { +const struct file_operations ll_dir_operations = { .llseek = ll_dir_seek, .open = ll_dir_open, .release = ll_dir_release,drivers/staging/lustre/lustre/llite/file.c +46
-43@@ -50,7 +50,17 @@#include "cl_object.h" -struct ll_file_data *ll_file_data_get (void ) +static int +ll_put_grouplock (struct inode *inode,struct file *file,unsigned long arg); + +static int ll_lease_close (struct obd_client_handle *och,struct inode *inode, +bool *lease_broken); + +static enum llioc_iter +ll_iocontrol_call (struct inode *inode,struct file *file, +unsigned int cmd,unsigned long arg,int *rcp); + +static struct ll_file_data *ll_file_data_get (void ) {struct ll_file_data *fd;@@ -247,8 +257,8 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode)return rc; } -int ll_md_close (struct obd_export *md_exp,struct inode *inode, -struct file *file) +static int ll_md_close (struct obd_export *md_exp,struct inode *inode, +struct file *file) {struct ll_file_data *fd =LUSTRE_FPRIVATE (file);struct ll_inode_info *lli =ll_i2info (inode);@@ -482,8 +492,8 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,return md_set_open_replay_data (md_exp, och, it); } -int ll_local_open (struct file *file,struct lookup_intent *it, -struct ll_file_data *fd,struct obd_client_handle *och) +static int ll_local_open (struct file *file,struct lookup_intent *it, +struct ll_file_data *fd,struct obd_client_handle *och) {struct inode *inode = file->f_dentry->d_inode;struct ll_inode_info *lli =ll_i2info (inode);@@ -733,8 +743,9 @@ static int ll_md_blocking_lease_ast(struct ldlm_lock *lock,/** * Acquire a lease and open the file. */ -struct obd_client_handle *ll_lease_open (struct inode *inode,struct file *file, -fmode_t fmode,__u64 open_flags) +static struct obd_client_handle * +ll_lease_open (struct inode *inode,struct file *file,fmode_t fmode, +__u64 open_flags) {struct lookup_intent it = { .it_op =IT_OPEN };struct ll_sb_info *sbi =ll_i2sbi (inode);@@ -862,14 +873,13 @@ out:OBD_FREE_PTR (och);return ERR_PTR (rc); } -EXPORT_SYMBOL (ll_lease_open);/** * Release lease and close the file. * It will check if the lease has ever broken. */ -int ll_lease_close (struct obd_client_handle *och,struct inode *inode, -bool *lease_broken) +static int ll_lease_close (struct obd_client_handle *och,struct inode *inode, +bool *lease_broken) {struct ldlm_lock *lock;bool cancelled = true;@@ -895,7 +905,6 @@ int ll_lease_close(struct obd_client_handle *och, struct inode *inode, NULL);return rc; } -EXPORT_SYMBOL (ll_lease_close);/* Fills the obdo with the attributes for the lsm */ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,@@ -1590,7 +1599,8 @@ static int ll_lov_getstripe(struct inode *inode, unsigned long arg)return rc; } -int ll_get_grouplock (struct inode *inode,struct file *file,unsigned long arg) +static int +ll_get_grouplock (struct inode *inode,struct file *file,unsigned long arg) {struct ll_inode_info *lli =ll_i2info (inode);struct ll_file_data *fd =LUSTRE_FPRIVATE (file);@@ -1710,8 +1720,8 @@ out:* Get size for inode for which FIEMAP mapping is requested. * Make the FIEMAP get_info call and returns the result. */ -int ll_do_fiemap (struct inode *inode,struct ll_user_fiemap *fiemap, -int num_bytes) +static int ll_do_fiemap (struct inode *inode,struct ll_user_fiemap *fiemap, +int num_bytes) {struct obd_export *exp =ll_i2dtexp (inode);struct lov_stripe_md *lsm =NULL ;@@ -2190,7 +2200,8 @@ out:return rc; } -long ll_file_ioctl (struct file *file,unsigned int cmd,unsigned long arg) +static long +ll_file_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {struct inode *inode = file->f_dentry->d_inode;struct ll_file_data *fd =LUSTRE_FPRIVATE (file);@@ -2509,7 +2520,7 @@ long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } -loff_t ll_file_seek (struct file *file,loff_t offset,int origin) +static loff_t ll_file_seek (struct file *file,loff_t offset,int origin) {struct inode *inode = file->f_dentry->d_inode;loff_t retval, eof =0 ;@@ -2533,7 +2544,7 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)return retval; } -int ll_flush (struct file *file,fl_owner_t id) +static int ll_flush (struct file *file,fl_owner_t id) {struct inode *inode = file->f_dentry->d_inode;struct ll_inode_info *lli =ll_i2info (inode);@@ -2670,7 +2681,8 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)return rc; } -int ll_file_flock (struct file *file,int cmd,struct file_lock *file_lock) +static int +ll_file_flock (struct file *file,int cmd,struct file_lock *file_lock) {struct inode *inode = file->f_dentry->d_inode;struct ll_sb_info *sbi =ll_i2sbi (inode);@@ -2799,7 +2811,8 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)return rc; } -int ll_file_noflock (struct file *file,int cmd,struct file_lock *file_lock) +static int +ll_file_noflock (struct file *file,int cmd,struct file_lock *file_lock) {return -ENOSYS ; }@@ -2891,8 +2904,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc)return rc; } -int __ll_inode_revalidate_it (struct dentry *dentry,struct lookup_intent *it, -__u64 ibits) +static int __ll_inode_revalidate (struct dentry *dentry,__u64 ibits) {struct inode *inode = dentry->d_inode;struct ptlrpc_request *req =NULL ;@@ -2987,13 +2999,12 @@ out:return rc; } -int ll_inode_revalidate_it (struct dentry *dentry,struct lookup_intent *it, -__u64 ibits) +static int ll_inode_revalidate (struct dentry *dentry,__u64 ibits) {struct inode *inode = dentry->d_inode;int rc; - rc =__ll_inode_revalidate_it (dentry, it, ibits); + rc =__ll_inode_revalidate (dentry, ibits);if (rc !=0 )return rc;@@ -3016,16 +3027,15 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,return rc; } -int ll_getattr_it (struct vfsmount *mnt,struct dentry *de, -struct lookup_intent *it,struct kstat *stat) +int ll_getattr (struct vfsmount *mnt,struct dentry *de,struct kstat *stat) {struct inode *inode = de->d_inode;struct ll_sb_info *sbi =ll_i2sbi (inode);struct ll_inode_info *lli =ll_i2info (inode);int res =0 ; - res =ll_inode_revalidate_it (de, it,MDS_INODELOCK_UPDATE | -MDS_INODELOCK_LOOKUP ); + res =ll_inode_revalidate (de,MDS_INODELOCK_UPDATE | +MDS_INODELOCK_LOOKUP );ll_stats_ops_tally (sbi,LPROC_LL_GETATTR ,1 );if (res)@@ -3051,15 +3061,9 @@ int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,return 0 ; } -int ll_getattr (struct vfsmount *mnt,struct dentry *de,struct kstat *stat) -{ -struct lookup_intent it = { .it_op =IT_GETATTR }; - -return ll_getattr_it (mnt, de, &it, stat); -} -int ll_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo, -__u64 start,__u64 len) +static int ll_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo, +__u64 start,__u64 len) {int rc;size_t num_bytes;@@ -3091,7 +3095,7 @@ int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,return rc; } -struct posix_acl *ll_get_acl (struct inode *inode,int type) +struct posix_acl *ll_get_acl (struct inode *inode,int type) {struct ll_inode_info *lli =ll_i2info (inode);struct posix_acl *acl =NULL ;@@ -3118,10 +3122,8 @@ int ll_inode_permission(struct inode *inode, int mask)* need to do it before permission check. */ if (inode == inode->i_sb->s_root->d_inode) { -struct lookup_intent it = { .it_op =IT_LOOKUP }; - - rc =__ll_inode_revalidate_it (inode->i_sb->s_root, &it, -MDS_INODELOCK_LOOKUP ); + rc =__ll_inode_revalidate (inode->i_sb->s_root, +MDS_INODELOCK_LOOKUP );if (rc)return rc; }@@ -3273,8 +3275,9 @@ void ll_iocontrol_unregister(void *magic)EXPORT_SYMBOL (ll_iocontrol_register);EXPORT_SYMBOL (ll_iocontrol_unregister); -enum llioc_iter ll_iocontrol_call (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg,int *rcp) +static enum llioc_iter +ll_iocontrol_call (struct inode *inode,struct file *file, +unsigned int cmd,unsigned long arg,int *rcp) {enum llioc_iter ret =LLIOC_CONT ;struct llioc_data *data;drivers/staging/lustre/lustre/llite/llite_capa.c +3
-1@@ -68,6 +68,8 @@ static unsigned long long ll_capa_renewal_noent = 0;static unsigned long long ll_capa_renewal_failed =0 ;static unsigned long long ll_capa_renewal_retries =0 ; +static int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa); +static inline void update_capa_timer (struct obd_capa *ocapa,cfs_time_t expiry) { if (cfs_time_before(expiry, ll_capa_timer.expires) ||@@ -515,7 +517,7 @@ static inline void delay_capa_renew(struct obd_capa *oc, cfs_time_t delay) oc->c_expiry =cfs_time_add (oc->c_expiry,cfs_time_seconds (delay)); } -int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa) +static int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa) {struct inode *inode = ocapa->u.cli.inode;int rc =0 ;drivers/staging/lustre/lustre/llite/llite_internal.h +21
-117@@ -71,10 +71,6 @@#define LUSTRE_FPRIVATE (file) ((file)->private_data)struct ll_dentry_data { -int lld_cwd_count; -int lld_mnt_count; -struct obd_client_handle lld_cwd_och; -struct obd_client_handle lld_mnt_och;struct lookup_intent *lld_it;unsigned int lld_sa_generation;unsigned int lld_invalid:1 ;@@ -83,8 +79,6 @@ struct ll_dentry_data {#define ll_d2d (de) ((struct ll_dentry_data*)((de)->d_fsdata)) -extern struct file_operations ll_pgcache_seq_fops; -#define LLI_INODE_MAGIC 0x111d0de5#define LLI_INODE_DEAD 0xdeadd00d@@ -120,16 +114,12 @@ enum lli_flags {/* Sizeon-on-MDS attributes are changed. An attribute update needs to * be sent to MDS. */ LLIF_SOM_DIRTY = (1 <<3 ), -/* File is contented */ -LLIF_CONTENDED = (1 <<4 ), -/* Truncate uses server lock for this file */ -LLIF_SRVLOCK = (1 <<5 ),/* File data is modified. */ -LLIF_DATA_MODIFIED = (1 <<6 ), +LLIF_DATA_MODIFIED = (1 <<4 ),/* File is being restored */ -LLIF_FILE_RESTORING = (1 <<7 ), +LLIF_FILE_RESTORING = (1 <<5 ),/* Xattr cache is attached to the file */ - LLIF_XATTR_CACHE = (1 << 8), + LLIF_XATTR_CACHE = (1 << 6), }; struct ll_inode_info {@@ -194,7 +184,6 @@ struct ll_inode_info {* cleanup the dir readahead. */ void *d_opendir_key;struct ll_statahead_info *d_sai; -struct posix_acl *d_def_acl;/* protect statahead stuff. */ spinlock_t d_sa_lock;/* "opendir_pid" is the token when lookup/revalid @@ -205,7 +194,6 @@ struct ll_inode_info {#define lli_readdir_mutex u.d.d_readdir_mutex#define lli_opendir_key u.d.d_opendir_key#define lli_sai u.d.d_sai -#define lli_def_acl u.d.d_def_acl#define lli_sa_lock u.d.d_sa_lock#define lli_opendir_pid u.d.d_opendir_pid@@ -232,11 +220,6 @@ struct ll_inode_info {/* for writepage() only to communicate to fsync */ int f_async_rc; -/* volatile file criteria is based on file name, this -* flag is used to keep the test result, so the strcmp -* is done only once -*/ -bool f_volatile;/* * whenever a process try to read/write the file, the * jobid of the process will be saved here, and it'll @@ -259,7 +242,6 @@ struct ll_inode_info {#define lli_agl_index u.f.f_agl_index#define lli_async_rc u.f.f_async_rc#define lli_jobid u.f.f_jobid -#define lli_volatile u.f.f_volatile } u;@@ -459,10 +441,6 @@ enum stats_track_type { "xattr", \ } -/* default value for ll_sb_info->contention_time */ -#define SBI_DEFAULT_CONTENTION_SECONDS 60 -/* default value for lockless_truncate_enable */ -#define SBI_DEFAULT_LOCKLESS_TRUNCATE_ENABLE 1#define RCE_HASHES 32struct rmtacl_ctl_entry {@@ -673,12 +651,6 @@ static inline struct inode *ll_info2i(struct ll_inode_info *lli)return &lli->lli_vfs_inode; } -struct it_cb_data { -struct inode *icbd_parent; -struct dentry **icbd_childp; -obd_id hash; -}; -__u32 ll_i2suppgid (struct inode *i);void ll_i2gids (__u32 *suppgids,struct inode *i1,struct inode *i2);@@ -686,21 +658,13 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi) {#if BITS_PER_LONG ==32 return 1 ; +#elif defined(CONFIG_COMPAT ) +return unlikely (is_compat_task () || (sbi->ll_flags &LL_SBI_32BIT_API ));#else - return unlikely( -#ifdef CONFIG_COMPAT -is_compat_task () || -#endif - (sbi->ll_flags &LL_SBI_32BIT_API ) - ); +return unlikely (sbi->ll_flags &LL_SBI_32BIT_API );#endif } -#define LLAP_MAGIC 98764321 - -extern struct kmem_cache *ll_async_page_slab; -extern size_t ll_async_page_slab_size; -void ll_ra_read_in (struct file *f,struct ll_ra_read *rar);void ll_ra_read_ex (struct file *f,struct ll_ra_read *rar);struct ll_ra_read *ll_ra_read_get (struct file *f);@@ -733,14 +697,16 @@ static inline void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,/* llite/dir.c */ void ll_release_page (struct page *page,int remove); -extern struct file_operations ll_dir_operations; -extern struct inode_operations ll_dir_inode_operations; +extern const struct file_operations ll_dir_operations; +extern const struct inode_operations ll_dir_inode_operations;struct page *ll_get_dir_page (struct inode *dir,__u64 hash,struct ll_dir_chain *chain);int ll_dir_read (struct inode *inode,struct dir_context *ctx);int ll_get_mdt_idx (struct inode *inode);/* llite/namei.c */ +extern const struct inode_operations ll_special_inode_operations; +int ll_objects_destroy (struct ptlrpc_request *request,struct inode *dir); struct inode *ll_iget(struct super_block *sb, ino_t hash,@@ -755,43 +721,34 @@ int ll_prepare_write(struct file *, struct page *, unsigned from, unsigned to);int ll_commit_write (struct file *,struct page *,unsigned from,unsigned to);int ll_writepage (struct page *page,struct writeback_control *wbc);int ll_writepages (struct address_space *,struct writeback_control *wbc); -void ll_removepage (struct page *page);int ll_readpage (struct file *file,struct page *page);void ll_readahead_init (struct inode *inode,struct ll_readahead_state *ras); -int ll_file_punch (struct inode *,loff_t ,int ); -ssize_t ll_file_lockless_io (struct file *,char *,size_t ,loff_t *,int ); -void ll_clear_file_contended (struct inode *); -int ll_sync_page_range (struct inode *,struct address_space *,loff_t ,size_t );int ll_readahead (const struct lu_env *env,struct cl_io *io,struct ll_readahead_state *ras,struct address_space *mapping,struct cl_page_list *queue,int flags); +#ifndef MS_HAS_NEW_AOPS +extern const struct address_space_operations ll_aops; +#else +extern const struct address_space_operations_ext ll_aops; +#endif +/* llite/file.c */ extern struct file_operations ll_file_operations;extern struct file_operations ll_file_operations_flock;extern struct file_operations ll_file_operations_noflock;extern struct inode_operations ll_file_inode_operations; -extern int ll_inode_revalidate_it (struct dentry *,struct lookup_intent *, -__u64 );extern int ll_have_md_lock (struct inode *inode,__u64 *bits,ldlm_mode_t l_req_mode);extern ldlm_mode_t ll_take_md_lock (struct inode *inode,__u64 bits,struct lustre_handle *lockh,__u64 flags,ldlm_mode_t mode); -int __ll_inode_revalidate_it (struct dentry *,struct lookup_intent *, -__u64 bits); -int ll_revalidate_nd (struct dentry *dentry,unsigned int flags);int ll_file_open (struct inode *inode,struct file *file);int ll_file_release (struct inode *inode,struct file *file);int ll_glimpse_ioctl (struct ll_sb_info *sbi,struct lov_stripe_md *lsm,lstat_t *st);void ll_ioepoch_open (struct ll_inode_info *lli,__u64 ioepoch); -int ll_local_open (struct file *file, -struct lookup_intent *it,struct ll_file_data *fd, -struct obd_client_handle *och);int ll_release_openhandle (struct dentry *,struct lookup_intent *); -int ll_md_close (struct obd_export *md_exp,struct inode *inode, -struct file *file);int ll_md_real_close (struct inode *inode,fmode_t fmode);void ll_ioepoch_close (struct inode *inode,struct md_op_data *op_data,struct obd_client_handle **och,unsigned long flags);@@ -799,15 +756,10 @@ void ll_done_writing_attr(struct inode *inode, struct md_op_data *op_data);int ll_som_update (struct inode *inode,struct md_op_data *op_data);int ll_inode_getattr (struct inode *inode,struct obdo *obdo,__u64 ioepoch,int sync); -int ll_md_setattr (struct dentry *dentry,struct md_op_data *op_data, -struct md_open_data **mod);void ll_pack_inode2opdata (struct inode *inode,struct md_op_data *op_data,struct lustre_handle *fh); -int ll_getattr_it (struct vfsmount *mnt,struct dentry *de, -struct lookup_intent *it,struct kstat *stat);int ll_getattr (struct vfsmount *mnt,struct dentry *de,struct kstat *stat); -struct ll_file_data *ll_file_data_get (void ); -struct posix_acl *ll_get_acl (struct inode *inode,int type); +struct posix_acl *ll_get_acl (struct inode *inode,int type);int ll_inode_permission (struct inode *inode,int mask);@@ -822,44 +774,30 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,int ll_dir_getstripe (struct inode *inode,struct lov_mds_md **lmmp,int *lmm_size,struct ptlrpc_request **request);int ll_fsync (struct file *file,loff_t start,loff_t end,int data); -int ll_do_fiemap (struct inode *inode,struct ll_user_fiemap *fiemap, -int num_bytes);int ll_merge_lvb (const struct lu_env *env,struct inode *inode); -int ll_get_grouplock (struct inode *inode,struct file *file,unsigned long arg); -int ll_put_grouplock (struct inode *inode,struct file *file,unsigned long arg);int ll_fid2path (struct inode *inode,void *arg);int ll_data_version (struct inode *inode,__u64 *data_version,int extent_lock);int ll_hsm_release (struct inode *inode); -struct obd_client_handle *ll_lease_open (struct inode *inode,struct file *file, -fmode_t mode,__u64 flags); -int ll_lease_close (struct obd_client_handle *och,struct inode *inode, -bool *lease_broken); -/* llite/dcache.c */ int ll_d_init (struct dentry *de); -extern struct dentry_operations ll_d_ops; +extern const struct dentry_operations ll_d_ops;void ll_intent_drop_lock (struct lookup_intent *);void ll_intent_release (struct lookup_intent *);void ll_invalidate_aliases (struct inode *); -void ll_frob_intent (struct lookup_intent **itp,struct lookup_intent *deft);void ll_lookup_finish_locks (struct lookup_intent *it,struct dentry *dentry); -int ll_dcompare (const struct dentry *parent,const struct dentry *dentry, -unsigned int len,const char *str,const struct qstr *d_name);int ll_revalidate_it_finish (struct ptlrpc_request *request,struct lookup_intent *it,struct dentry *de);/* llite/llite_lib.c */ extern struct super_operations lustre_super_operations; -char *ll_read_opt (const char *opt,char *data);void ll_lli_init (struct ll_inode_info *lli);int ll_fill_super (struct super_block *sb,struct vfsmount *mnt);void ll_put_super (struct super_block *sb);void ll_kill_super (struct super_block *sb);struct inode *ll_inode_from_resource_lock (struct ldlm_lock *lock); -struct inode *ll_inode_from_lock (struct ldlm_lock *lock);void ll_clear_inode (struct inode *inode);int ll_setattr_raw (struct dentry *dentry,struct iattr *attr,bool hsm_import);int ll_setattr (struct dentry *de,struct iattr *attr);@@ -879,7 +817,6 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret);int ll_prep_inode (struct inode **inode,struct ptlrpc_request *req,struct super_block *,struct lookup_intent *);void lustre_dump_dentry (struct dentry *,int recur); -void lustre_dump_inode (struct inode *);int ll_obd_statfs (struct inode *inode,void *arg);int ll_get_max_mdsize (struct ll_sb_info *sbi,int *max_mdsize);int ll_get_default_mdsize (struct ll_sb_info *sbi,int *default_mdsize);@@ -901,15 +838,6 @@ void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid);struct inode *search_inode_for_lustre (struct super_block *sb,const struct lu_fid *fid); -/* llite/special.c */ -extern struct inode_operations ll_special_inode_operations; -extern struct file_operations ll_special_chr_inode_fops; -extern struct file_operations ll_special_chr_file_fops; -extern struct file_operations ll_special_blk_inode_fops; -extern struct file_operations ll_special_fifo_inode_fops; -extern struct file_operations ll_special_fifo_file_fops; -extern struct file_operations ll_special_sock_inode_fops; -/* llite/symlink.c */ extern struct inode_operations ll_fast_symlink_inode_operations;@@ -977,11 +905,6 @@ struct vvp_io {* Set when cui_bead has been initialized. */ int cui_ra_window_set; -/** -* Partially truncated page, that vvp_io_trunc_start() keeps locked -* across truncate. -*/ -struct cl_page *cui_partpage; };/** @@ -1010,12 +933,9 @@ struct ll_cl_context {struct cl_page *lcc_page;struct lu_env *lcc_env;int lcc_refcheck; -int lcc_created; };struct vvp_thread_info { -struct ost_lvb vti_lvb; -struct cl_2queue vti_queue;struct iovec vti_local_iov;struct vvp_io_args vti_args;struct ra_io_arg vti_ria;@@ -1062,25 +982,17 @@ static inline struct vvp_io *vvp_env_io(const struct lu_env *env)return &vvp_env_session (env)->vs_ios; } +int vvp_global_init (void ); +void vvp_global_fini (void ); +void ll_queue_done_writing (struct inode *inode,unsigned long flags);void ll_close_thread_shutdown (struct ll_close_queue *lcq);int ll_close_thread_start (struct ll_close_queue **lcq_ret);/* llite/llite_mmap.c */ -typedef struct rb_root rb_root_t ; -typedef struct rb_node rb_node_t ; - -struct ll_lock_tree_node ; -struct ll_lock_tree { -rb_root_t lt_root; -struct list_head lt_locked_list; -struct ll_file_data *lt_fd; -};int ll_teardown_mmaps (struct address_space *mapping,__u64 first,__u64 last);int ll_file_mmap (struct file * file,struct vm_area_struct * vma); -struct ll_lock_tree_node *ll_node_from_inode (struct inode *inode,__u64 start, -__u64 end,ldlm_mode_t mode);void policy_from_vma (ldlm_policy_data_t *policy,struct vm_area_struct *vma,unsigned long addr,size_t count); struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,@@ -1164,7 +1076,6 @@ int ll_removexattr(struct dentry *dentry, const char *name);extern struct kmem_cache *ll_remote_perm_cachep;extern struct kmem_cache *ll_rmtperm_hash_cachep; -struct hlist_head *alloc_rmtperm_hash (void );void free_rmtperm_hash (struct hlist_head *hash);int ll_update_remote_perm (struct inode *inode,struct mdt_remote_perm *perm);int lustre_check_remote_perm (struct inode *inode,int mask);@@ -1177,7 +1088,6 @@ void ll_capa_thread_stop(void);void ll_capa_timer_callback (unsigned long unused);struct obd_capa *ll_add_capa (struct inode *inode,struct obd_capa *ocapa); -int ll_update_capa (struct obd_capa *ocapa,struct lustre_capa *capa);void ll_capa_open (struct inode *inode);void ll_capa_close (struct inode *inode);@@ -1197,14 +1107,12 @@ extern struct lu_device_type vvp_device_type;*/ int cl_sb_init (struct super_block *sb);int cl_sb_fini (struct super_block *sb); -enum cl_lock_mode vvp_mode_from_vma (struct vm_area_struct *vma);void ll_io_init (struct cl_io *io,const struct file *file,int write);void ras_update (struct ll_sb_info *sbi,struct inode *inode,struct ll_readahead_state *ras,unsigned long index,unsigned hit);void ll_ra_count_put (struct ll_sb_info *sbi,unsigned long len); -int ll_is_file_contended (struct file *file);void ll_ra_stats_inc (struct address_space *mapping,enum ra_stat which);/* llite/llite_rmtacl.c */ @@ -1277,7 +1185,6 @@ struct ll_statahead_info {unsigned int sai_skip_hidden;/* skipped hidden dentry count */ unsigned int sai_ls_all:1, /* "ls -al", do stat-ahead for* hidden entries */ - sai_in_readpage:1,/* statahead is in readdir()*/ sai_agl_valid:1;/* AGL is valid for the dir */wait_queue_head_t sai_waitq;/* stat-ahead wait queue */ struct ptlrpc_thread sai_thread;/* stat-ahead thread */ @@ -1402,9 +1309,6 @@ typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg, void *magic, int *rcp); -enum llioc_iter ll_iocontrol_call (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg,int *rcp); -/* export functions */ /* Register ioctl block dynamatically for a regular file. * drivers/staging/lustre/lustre/llite/llite_lib.c +5
-59@@ -58,14 +58,8 @@struct kmem_cache *ll_file_data_slab;struct proc_dir_entry *proc_lustre_fs_root; -LIST_HEAD (ll_super_blocks); -DEFINE_SPINLOCK (ll_sb_lock); - -#ifndef MS_HAS_NEW_AOPS -extern struct address_space_operations ll_aops; -#else -extern struct address_space_operations_ext ll_aops; -#endif +static LIST_HEAD (ll_super_blocks); +static DEFINE_SPINLOCK (ll_sb_lock);#ifndef log2#define log2 (n) ffz(~(n))@@ -143,7 +137,7 @@ static struct ll_sb_info *ll_init_sbi(void)return sbi; } -void ll_free_sbi (struct super_block *sb) +static void ll_free_sbi (struct super_block *sb) {struct ll_sb_info *sbi =ll_s2sbi (sb);@@ -673,7 +667,7 @@ int ll_get_default_cookiesize(struct ll_sb_info *sbi, int *lmmsize)return rc; } -void ll_dump_inode (struct inode *inode) +static void ll_dump_inode (struct inode *inode) {struct ll_d_hlist_node *tmp;int dentry_count =0 ;@@ -716,7 +710,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur) } } -void client_common_put_super (struct super_block *sb) +static void client_common_put_super (struct super_block *sb) {struct ll_sb_info *sbi =ll_s2sbi (sb);@@ -765,30 +759,6 @@ void ll_kill_super(struct super_block *sb) } } -char *ll_read_opt (const char *opt,char *data) -{ -char *value; -char *retval; - -CDEBUG (D_SUPER ,"option: %s, data %s\n" , opt, data); -if (strncmp (opt, data,strlen (opt))) -return NULL ; - value =strchr (data,'=' ); -if (value ==NULL ) -return NULL ; - - value++; -OBD_ALLOC (retval,strlen (value) +1 ); -if (!retval) { -CERROR ("out of memory!\n" ); -return NULL ; - } - -memcpy (retval, value,strlen (value)+1 ); -CDEBUG (D_SUPER ,"Assigned option: %s, value %s\n" , opt, retval); -return retval; -} -static inline int ll_set_opt (const char *opt,char *data,int fl) {if (strncmp (opt, data,strlen (opt)) !=0 )@@ -978,7 +948,6 @@ void ll_lli_init(struct ll_inode_info *lli)mutex_init (&lli->lli_readdir_mutex); lli->lli_opendir_key =NULL ; lli->lli_sai =NULL ; - lli->lli_def_acl =NULL ;spin_lock_init (&lli->lli_sa_lock); lli->lli_opendir_pid =0 ; }else {@@ -991,7 +960,6 @@ void ll_lli_init(struct ll_inode_info *lli)INIT_LIST_HEAD (&lli->lli_agl_list); lli->lli_agl_index =0 ; lli->lli_async_rc =0 ; - lli->lli_volatile = false; }mutex_init (&lli->lli_layout_mutex); }@@ -1190,28 +1158,6 @@ struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock)return inode; } -struct inode *ll_inode_from_lock (struct ldlm_lock *lock) -{ -struct inode *inode =NULL ; -/* NOTE: we depend on atomic igrab() -bzzz */ -lock_res_and_lock (lock); -if (lock->l_ast_data) { -struct ll_inode_info *lli =ll_i2info (lock->l_ast_data); -if (lli->lli_inode_magic ==LLI_INODE_MAGIC ) { - inode =igrab (lock->l_ast_data); - }else { - inode = lock->l_ast_data; -LDLM_DEBUG_LIMIT (inode->i_state &I_FREEING ?D_INFO : -D_WARNING , lock,"l_ast_data %p is " -"bogus: magic %08x" , lock->l_ast_data, - lli->lli_inode_magic); - inode =NULL ; - } - } -unlock_res_and_lock (lock); -return inode; -} -void ll_clear_inode (struct inode *inode) {struct ll_inode_info *lli =ll_i2info (inode);drivers/staging/lustre/lustre/llite/llite_mmap.c +6
-17@@ -51,10 +51,7 @@#include "llite_internal.h" #include <linux/lustre_compat25.h> -struct page *ll_nopage (struct vm_area_struct *vma,unsigned long address, -int *type); - -static struct vm_operations_struct ll_file_vm_ops; +static const struct vm_operations_struct ll_file_vm_ops; void policy_from_vma(ldlm_policy_data_t *policy, struct vm_area_struct *vma, unsigned long addr,@@ -97,10 +94,10 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,* \retval EINVAL if env can't allocated * \return other error codes from cl_io_init. */ -struct cl_io *ll_fault_io_init (struct vm_area_struct *vma, -struct lu_env **env_ret, -struct cl_env_nest *nest, -pgoff_t index,unsigned long *ra_flags) +static struct cl_io * +ll_fault_io_init (struct vm_area_struct *vma,struct lu_env **env_ret, +struct cl_env_nest *nest,pgoff_t index, +unsigned long *ra_flags) {struct file *file = vma->vm_file;struct inode *inode = file->f_dentry->d_inode;@@ -446,14 +443,6 @@ static void ll_vm_close(struct vm_area_struct *vma)LASSERT (atomic_read (&vob->cob_mmap_cnt) >=0 ); } - -/* return the user space pointer that maps to a file offset via a vma */ -static inline unsigned long file_to_user (struct vm_area_struct *vma,__u64 byte) -{ -return vma->vm_start + (byte - ((__u64 )vma->vm_pgoff <<PAGE_CACHE_SHIFT )); - -} -/* XXX put nice comment here. talk about __free_pte -> dirty pages and * nopage's reference passing to the pte */ int ll_teardown_mmaps (struct address_space *mapping,__u64 first,__u64 last)@@ -470,7 +459,7 @@ int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last)return rc; } -static struct vm_operations_struct ll_file_vm_ops = { +static const struct vm_operations_struct ll_file_vm_ops = { .fault = ll_fault, .page_mkwrite = ll_page_mkwrite, .open = ll_vm_open,drivers/staging/lustre/lustre/llite/lloop.c +0
-5@@ -122,9 +122,6 @@ struct lloop_device {loff_t lo_offset;loff_t lo_sizelimit;int lo_flags; -int (*ioctl)(struct lloop_device *,int cmd, -unsigned long arg); -struct file *lo_backing_file;struct block_device *lo_device;unsigned lo_blocksize;@@ -509,7 +506,6 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, lo->lo_device = bdev; lo->lo_flags = lo_flags; lo->lo_backing_file = file; - lo->ioctl =NULL ; lo->lo_sizelimit =0 ; lo->old_gfp_mask =mapping_gfp_mask (mapping);mapping_set_gfp_mask (mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));@@ -568,7 +564,6 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,down (&lo->lo_sem); lo->lo_backing_file =NULL ; - lo->ioctl =NULL ; lo->lo_device =NULL ; lo->lo_offset =0 ; lo->lo_sizelimit =0 ;drivers/staging/lustre/lustre/llite/lproc_llite.c +2
-2@@ -41,9 +41,9 @@#include <obd_support.h> #include "llite_internal.h" +#include "vvp_internal.h" /* /proc/lustre/llite mount point registration */ -extern struct file_operations vvp_dump_pgcache_file_ops;static struct file_operations ll_rw_extents_stats_fops;static struct file_operations ll_rw_extents_stats_pp_fops;static struct file_operations ll_rw_offset_stats_fops;@@ -837,7 +837,7 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {#define MAX_STRING_SIZE 128 -struct llite_file_opcode { +static const struct llite_file_opcode { __u32 opcode; __u32 type; const char *opname;drivers/staging/lustre/lustre/llite/namei.c +10
-30@@ -75,14 +75,6 @@ static int ll_d_mountpoint(struct dentry *dparent, struct dentry *dchild,return mounted; } -int ll_unlock (__u32 mode,struct lustre_handle *lockh) -{ -ldlm_lock_decref (lockh, mode); - -return 0 ; -} - -/* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ static int ll_test_inode (struct inode *inode,void *opaque) {@@ -433,12 +425,10 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)return de; } -int ll_lookup_it_finish (struct ptlrpc_request *request, -struct lookup_intent *it,void *data) +static int ll_lookup_it_finish (struct ptlrpc_request *request, +struct lookup_intent *it, +struct inode *parent,struct dentry **de) { -struct it_cb_data *icbd = data; -struct dentry **de = icbd->icbd_childp; -struct inode *parent = icbd->icbd_parent;struct inode *inode =NULL ;__u64 bits =0 ;int rc;@@ -513,7 +503,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,struct dentry *save = dentry, *retval;struct ptlrpc_request *req =NULL ;struct md_op_data *op_data; -struct it_cb_data icbd;__u32 opc;int rc;@@ -527,7 +516,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,if (d_mountpoint (dentry))CERROR ("Tell Peter, lookup on mtpt, it %s\n" ,LL_IT2STR (it)); -ll_frob_intent (&it, &lookup_it); +if (it ==NULL || it->it_op ==IT_GETXATTR ) + it = &lookup_it;if (it->it_op ==IT_GETATTR ) { rc =ll_statahead_enter (parent, &dentry,0 );@@ -538,9 +528,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, } } - icbd.icbd_childp = &dentry; - icbd.icbd_parent = parent; -if (it->it_op &IT_CREAT ) opc =LUSTRE_OPC_CREATE ;else @@ -562,7 +549,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,if (rc <0 )GOTO (out, retval =ERR_PTR (rc)); - rc =ll_lookup_it_finish (req, it, &icbd); + rc =ll_lookup_it_finish (req, it, parent, &dentry);if (rc !=0 ) {ll_intent_release (it);GOTO (out, retval =ERR_PTR (rc));@@ -697,10 +684,7 @@ out_release:/* We depend on "mode" being set with the proper file type/umask by now */ -static struct inode *ll_create_node (struct inode *dir,const char *name, -int namelen,const void *data,int datalen, -int mode,__u64 extra, -struct lookup_intent *it) +static struct inode *ll_create_node (struct inode *dir,struct lookup_intent *it) {struct inode *inode =NULL ;struct ptlrpc_request *request =NULL ;@@ -757,14 +741,10 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,if (rc)return rc; - inode =ll_create_node (dir, dentry->d_name.name, dentry->d_name.len, -NULL ,0 , mode,0 , it); + inode =ll_create_node (dir, it);if (IS_ERR (inode))return PTR_ERR (inode); -if (filename_is_volatile (dentry->d_name.name, dentry->d_name.len,NULL )) -ll_i2info (inode)->lli_volatile = true; -d_instantiate (dentry, inode);return 0 ; }@@ -1238,7 +1218,7 @@ static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,return err; } -struct inode_operations ll_dir_inode_operations = { +const struct inode_operations ll_dir_inode_operations = { .mknod = ll_mknod, .atomic_open = ll_atomic_open, .lookup = ll_lookup_nd,@@ -1260,7 +1240,7 @@ struct inode_operations ll_dir_inode_operations = { .get_acl = ll_get_acl, }; -struct inode_operations ll_special_inode_operations = { +const struct inode_operations ll_special_inode_operations = { .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission,drivers/staging/lustre/lustre/llite/remote_perm.c +1
-1@@ -77,7 +77,7 @@ static inline void free_ll_remote_perm(struct ll_remote_perm *lrp)OBD_SLAB_FREE (lrp, ll_remote_perm_cachep,sizeof (*lrp)); } -struct hlist_head *alloc_rmtperm_hash (void ) +static struct hlist_head *alloc_rmtperm_hash (void ) {struct hlist_head *hash;int i;drivers/staging/lustre/lustre/llite/rw.c +0
-7@@ -77,12 +77,6 @@ static void ll_cl_fini(struct ll_cl_context *lcc)cl_page_put (env, page); } -if (io && lcc->lcc_created) { -cl_io_end (env, io); -cl_io_unlock (env, io); -cl_io_iter_fini (env, io); -cl_io_fini (env, io); - }cl_env_put (env, &lcc->lcc_refcheck); }@@ -167,7 +161,6 @@ static struct ll_cl_context *ll_cl_init(struct file *file, } }else result = io->ci_result; - lcc->lcc_created =1 ; } lcc->lcc_io = io;drivers/staging/lustre/lustre/llite/rw26.c +6
-9@@ -529,9 +529,9 @@ static int ll_write_end(struct file *file, struct address_space *mapping, }#ifdef CONFIG_MIGRATION -int ll_migratepage (struct address_space *mapping, -struct page *newpage,struct page *page - ,enum migrate_mode mode +static int ll_migratepage (struct address_space *mapping, +struct page *newpage,struct page *page, +enum migrate_mode mode ) {/* Always fail page migration until we have a proper implementation */ @@ -540,9 +540,8 @@ int ll_migratepage(struct address_space *mapping,#endif #ifndef MS_HAS_NEW_AOPS -struct address_space_operations ll_aops = { - .readpage = ll_readpage, -// .readpages = ll_readpages, +const struct address_space_operations ll_aops = { + .readpage = ll_readpage, .direct_IO = ll_direct_IO_26, .writepage = ll_writepage, .writepages = ll_writepages,@@ -554,10 +553,9 @@ struct address_space_operations ll_aops = {#ifdef CONFIG_MIGRATION .migratepage = ll_migratepage, #endif - .bmap =NULL };#else -struct address_space_operations_ext ll_aops = { +const struct address_space_operations_ext ll_aops = { .orig_aops.readpage = ll_readpage,// .orig_aops.readpages = ll_readpages, .orig_aops.direct_IO = ll_direct_IO_26,@@ -571,7 +569,6 @@ struct address_space_operations_ext ll_aops = {#ifdef CONFIG_MIGRATION .orig_aops.migratepage = ll_migratepage, #endif - .orig_aops.bmap = NULL, .write_begin = ll_write_begin, .write_end = ll_write_end };drivers/staging/lustre/lustre/llite/statahead.c +0
-8@@ -1230,9 +1230,7 @@ do_it:*/ ll_release_page (page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); - sai->sai_in_readpage =1 ; page =ll_get_dir_page (dir, pos, &chain); - sai->sai_in_readpage =0 ; }else {LASSERT (le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE );ll_release_page (page,1 );@@ -1563,12 +1561,6 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,return entry ?1 : -EAGAIN ; } -/* if statahead is busy in readdir, help it do post-work */ -while (!ll_sa_entry_stated (entry) && - sai->sai_in_readpage && - !sa_received_empty (sai)) -ll_post_statahead (sai); -if (!ll_sa_entry_stated (entry)) { sai->sai_index_wait = entry->se_index; lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,drivers/staging/lustre/lustre/llite/super25.c +2
-5@@ -72,7 +72,7 @@ static void ll_destroy_inode(struct inode *inode)call_rcu (&inode->i_rcu, ll_inode_destroy_callback); } -int ll_init_inodecache (void ) +static int ll_init_inodecache (void ) { ll_inode_cachep = kmem_cache_create("lustre_inode_cache", sizeof(struct ll_inode_info),@@ -82,7 +82,7 @@ int ll_init_inodecache(void)return 0 ; } -void ll_destroy_inodecache (void ) +static void ll_destroy_inodecache (void ) {kmem_cache_destroy (ll_inode_cachep); }@@ -103,9 +103,6 @@ MODULE_ALIAS_FS("lustre");void lustre_register_client_process_config (int (*cpc)(struct lustre_cfg *lcfg)); -int vvp_global_init (void ); -void vvp_global_fini (void ); -static int __init init_lustre_lite (void ) {int i, rc, seed[2 ];drivers/staging/lustre/lustre/llite/vvp_dev.c +3
-3@@ -43,7 +43,7 @@#include <obd.h> #include <lustre_lite.h> - +#include "llite_internal.h" #include "vvp_internal.h" /***************************************************************************** @@ -57,7 +57,7 @@* "llite_" (var. "ll_") prefix. */ -struct kmem_cache *vvp_thread_kmem; +static struct kmem_cache *vvp_thread_kmem;static struct kmem_cache *vvp_session_kmem;static struct lu_kmem_descr vvp_caches[] = { {@@ -536,7 +536,7 @@ static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp)return result; } -struct file_operations vvp_dump_pgcache_file_ops = { +const struct file_operations vvp_dump_pgcache_file_ops = { .owner =THIS_MODULE , .open = vvp_dump_pgcache_seq_open, .read = seq_read,drivers/staging/lustre/lustre/llite/vvp_internal.h +1
-1@@ -57,6 +57,6 @@ struct lu_object *vvp_object_alloc(const struct lu_env *env,struct ccc_object *cl_inode2ccc (struct inode *inode); -extern struct kmem_cache *vvp_thread_kmem; +extern const struct file_operations vvp_dump_pgcache_file_ops;#endif /* VVP_INTERNAL_H */ drivers/staging/lustre/lustre/llite/vvp_io.c +1
-1@@ -190,7 +190,7 @@ static void vvp_io_fault_fini(const struct lu_env *env,vvp_io_fini (env, ios); } -enum cl_lock_mode vvp_mode_from_vma (struct vm_area_struct *vma) +static enum cl_lock_mode vvp_mode_from_vma (struct vm_area_struct *vma) {/* * we only want to hold PW locks if the mmap() can generate drivers/staging/lustre/lustre/llite/vvp_object.c +2
-2@@ -120,8 +120,8 @@ static int vvp_attr_set(const struct lu_env *env, struct cl_object *obj,return 0 ; } -int vvp_conf_set (const struct lu_env *env,struct cl_object *obj, -const struct cl_object_conf *conf) +static int vvp_conf_set (const struct lu_env *env,struct cl_object *obj, +const struct cl_object_conf *conf) {struct ll_inode_info *lli =ll_i2info (conf->coc_inode);drivers/staging/lustre/lustre/llite/xattr_cache.c +1
-2@@ -232,7 +232,7 @@ static int ll_xattr_cache_list(struct list_head *cache,* \retval 0 @cache is not initialized * \retval 1 @cache is initialized */ -int ll_xattr_cache_valid (struct ll_inode_info *lli) +static int ll_xattr_cache_valid (struct ll_inode_info *lli) {return !!(lli->lli_flags &LLIF_XATTR_CACHE ); } --1.8.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Thanks, //richard
PATCH 42/47 staging/lustre: remove assertion of spin_is_locked()
In reply to Oleg DrokinFrom: Li Xi <[email protected]>
spin_is_locked() is always false when the platform is uniprocessor and CONFIG_DEBUG_SPINLOCK is not enabled. This patch replaces its assertion by assert_spin_locked().
Reviewed-on: http://review.whamcloud.com/8144
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199
--- drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_cl_internal.h | 9 +++++++++ drivers/staging/lustre/lustre/ptlrpc/client.c | 8 +++----- drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 4 ++-- 16 files changed, 31 insertions(+), 24 deletions(-)
drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h +1 -1
@@ -66,7 +66,7 @@* - spin_unlock(x) * - spin_unlock_bh(x) * - spin_trylock(x) -* - spin_is_locked(x) +* - assert_spin_locked(x) * * - spin_lock_irq(x) * - spin_lock_irqsave(x, f)
drivers/staging/lustre/lustre/include/lustre_dlm.h +1 -1
@@ -1445,7 +1445,7 @@ static inline void unlock_res(struct ldlm_resource *res)/** Check if resource is already locked, assert if not. */ static inline void check_res_locked (struct ldlm_resource *res) { -LASSERT (spin_is_locked (&res->lr_lock)); +assert_spin_locked (&res->lr_lock); }struct ldlm_resource *lock_res_and_lock (struct ldlm_lock *lock);
drivers/staging/lustre/lustre/include/lustre_net.h +1 -1
@@ -719,7 +719,7 @@ struct ptlrpc_nrs_pol_ops {* \a nrq * \param[in,out] nrq The request * -* \pre spin_is_locked(&svcpt->scp_req_lock) +* \pre assert_spin_locked(&svcpt->scp_req_lock) * * \see ptlrpc_nrs_req_stop_nolock() */
drivers/staging/lustre/lustre/lov/lov_merge.c +2 -2
@@ -58,7 +58,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm,int i;int rc =0 ; -LASSERT (spin_is_locked (&lsm->lsm_lock)); +assert_spin_locked (&lsm->lsm_lock);LASSERT (lsm->lsm_lock_owner ==current_pid ()); CDEBUG(D_INODE, "MDT ID "DOSTID" initial value: s="LPU64" m="LPU64
@@ -145,7 +145,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,int stripe =0 ;__u64 kms; -LASSERT (spin_is_locked (&lsm->lsm_lock)); +assert_spin_locked (&lsm->lsm_lock);LASSERT (lsm->lsm_lock_owner ==current_pid ());if (shrink) {
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
@@ -478,7 +478,7 @@ static struct cl_lock *cl_lock_lookup(const struct lu_env *env,struct cl_object_header *head; head =cl_object_header (obj); -LINVRNT (spin_is_locked (&head->coh_lock_guard)); +assert_spin_locked (&head->coh_lock_guard);CS_LOCK_INC (obj, lookup);list_for_each_entry (lock, &head->coh_locks, cll_linkage) {int matched;
drivers/staging/lustre/lustre/obdclass/cl_object.c +2 -2
@@ -220,7 +220,7 @@ int cl_object_attr_get(const struct lu_env *env, struct cl_object *obj,struct lu_object_header *top;int result; -LASSERT (spin_is_locked (cl_object_attr_guard (obj))); +assert_spin_locked (cl_object_attr_guard (obj)); top = obj->co_lu.lo_header; result =0 ;
@@ -251,7 +251,7 @@ int cl_object_attr_set(const struct lu_env *env, struct cl_object *obj,struct lu_object_header *top;int result; -LASSERT (spin_is_locked (cl_object_attr_guard (obj))); +assert_spin_locked (cl_object_attr_guard (obj)); top = obj->co_lu.lo_header; result =0 ;
drivers/staging/lustre/lustre/obdclass/cl_page.c +1 -1
@@ -130,7 +130,7 @@ struct cl_page *cl_page_lookup(struct cl_object_header *hdr, pgoff_t index) {struct cl_page *page; -LASSERT (spin_is_locked (&hdr->coh_page_guard)); +assert_spin_locked (&hdr->coh_page_guard); page =radix_tree_lookup (&hdr->coh_tree, index);if (page !=NULL )
drivers/staging/lustre/lustre/osc/osc_cache.c +2 -2
@@ -1311,7 +1311,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,static void osc_consume_write_grant (struct client_obd *cli,struct brw_page *pga) { -LASSERT (spin_is_locked (&cli->cl_loi_list_lock.lock)); +assert_spin_locked (&cli->cl_loi_list_lock.lock);LASSERT (!(pga->flag &OBD_BRW_FROM_GRANT ));atomic_inc (&obd_dirty_pages); cli->cl_dirty +=PAGE_CACHE_SIZE ;
@@ -1326,7 +1326,7 @@ static void osc_consume_write_grant(struct client_obd *cli,static void osc_release_write_grant (struct client_obd *cli,struct brw_page *pga) { -LASSERT (spin_is_locked (&cli->cl_loi_list_lock.lock)); +assert_spin_locked (&cli->cl_loi_list_lock.lock);if (!(pga->flag &OBD_BRW_FROM_GRANT )) {return ; }
drivers/staging/lustre/lustre/osc/osc_cl_internal.h +9 -0
@@ -176,7 +176,16 @@ static inline void osc_object_unlock(struct osc_object *obj)static inline int osc_object_is_locked (struct osc_object *obj) { +#if defined(CONFIG_SMP ) || defined(CONFIG_DEBUG_SPINLOCK )return spin_is_locked (&obj->oo_lock); +#else +/* +* It is not perfect to return true all the time. +* But since this function is only used for assertion +* and checking, it seems OK. +*/ +return 1 ; +#endif }/*
drivers/staging/lustre/lustre/ptlrpc/client.c +3 -5
@@ -2271,7 +2271,7 @@ static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked);*/ void ptlrpc_req_finished_with_imp_lock (struct ptlrpc_request *request) { -LASSERT (spin_is_locked (&request->rq_import->imp_lock)); +assert_spin_locked (&request->rq_import->imp_lock); (void )__ptlrpc_req_finished (request,1 ); }EXPORT_SYMBOL (ptlrpc_req_finished_with_imp_lock);
@@ -2452,9 +2452,7 @@ void ptlrpc_free_committed(struct obd_import *imp)bool skip_committed_list = true;LASSERT (imp !=NULL ); - -LASSERT (spin_is_locked (&imp->imp_lock)); - +assert_spin_locked (&imp->imp_lock);if (imp->imp_peer_committed_transno == imp->imp_last_transno_checked && imp->imp_generation == imp->imp_last_generation_checked) {
@@ -2585,7 +2583,7 @@ void ptlrpc_retain_replayable_request(struct ptlrpc_request *req, {struct list_head *tmp; -LASSERT (spin_is_locked (&imp->imp_lock)); +assert_spin_locked (&imp->imp_lock);if (req->rq_transno ==0 ) {DEBUG_REQ (D_EMERG , req,"saving request with zero transno" );
drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c +2 -2
@@ -137,7 +137,7 @@ void ctx_enhash_pf(struct ptlrpc_cli_ctx *ctx, struct hlist_head *hash)static void ctx_unhash_pf (struct ptlrpc_cli_ctx *ctx,struct hlist_head *freelist) { -LASSERT (spin_is_locked (&ctx->cc_sec->ps_lock)); +assert_spin_locked (&ctx->cc_sec->ps_lock);LASSERT (atomic_read (&ctx->cc_refcount) >0 );LASSERT (test_bit (PTLRPC_CTX_CACHED_BIT , &ctx->cc_flags));LASSERT (!hlist_unhashed (&ctx->cc_cache));
@@ -719,7 +719,7 @@ void gss_unhash_msg_nolock(struct gss_upcall_msg *gmsg)__u32 idx = gmsg->gum_mechidx;LASSERT (idx <MECH_MAX ); -LASSERT (spin_is_locked (&upcall_locks[idx])); +assert_spin_locked (&upcall_locks[idx]);if (list_empty (&gmsg->gum_list))return ;
drivers/staging/lustre/lustre/ptlrpc/import.c +1 -1
@@ -194,7 +194,7 @@ int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt)/* Must be called with imp_lock held! */ static void ptlrpc_deactivate_and_unlock_import (struct obd_import *imp) { -LASSERT (spin_is_locked (&imp->imp_lock)); +assert_spin_locked (&imp->imp_lock);CDEBUG (D_HA ,"setting import %s INVALID\n" ,obd2cli_tgt (imp->imp_obd)); imp->imp_invalid =1 ;
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +1 -1
@@ -449,7 +449,7 @@ void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, {LASSERT (policy !=NULL );LASSERT (info !=NULL ); -LASSERT (spin_is_locked (&policy->pol_nrs->nrs_lock)); +assert_spin_locked (&policy->pol_nrs->nrs_lock);memcpy (info->pi_name, policy->pol_desc->pd_name,NRS_POL_NAME_MAX );
drivers/staging/lustre/lustre/ptlrpc/pinger.c +1 -1
@@ -368,7 +368,7 @@ EXPORT_SYMBOL(ptlrpc_pinger_sending_on_import);void ptlrpc_pinger_commit_expected (struct obd_import *imp) {ptlrpc_update_next_ping (imp,1 ); -LASSERT (spin_is_locked (&imp->imp_lock)); +assert_spin_locked (&imp->imp_lock);/* * Avoid reading stale imp_connect_data. When not sure if pings are * expected or not on next connection, we assume they are not and force
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
@@ -450,7 +450,7 @@ out:static inline void enc_pools_wakeup (void ) { -LASSERT (spin_is_locked (&page_pools.epp_lock)); +assert_spin_locked (&page_pools.epp_lock);LASSERT (page_pools.epp_waitqlen >=0 );if (unlikely (page_pools.epp_waitqlen)) {
drivers/staging/lustre/lustre/ptlrpc/service.c +2 -2
@@ -384,8 +384,8 @@ void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs)void ptlrpc_schedule_difficult_reply (struct ptlrpc_reply_state *rs) { -LASSERT (spin_is_locked (&rs->rs_svcpt->scp_rep_lock)); -LASSERT (spin_is_locked (&rs->rs_lock)); +assert_spin_locked (&rs->rs_svcpt->scp_rep_lock); +assert_spin_locked (&rs->rs_lock);LASSERT (rs->rs_difficult); rs->rs_scheduled_ever =1 ;/* flag any notification attempt */
Signature · 1 line
1.8.5.3
PATCH 43/47 staging/lustre/osc: Update inode timestamp for lockless IO as well
In reply to Oleg DrokinFrom: Swapnil Pimpale <[email protected]>
Removed the checks for oi_lockless from osc_io_read_start() and osc_io_write_start(). This patch also removes the unnecessary call to cl_object_attr_get() in osc_io_write_start() before calling cl_object_attr_set()
Reviewed-on: http://review.whamcloud.com/8797
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3868
--- drivers/staging/lustre/lustre/osc/osc_io.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
drivers/staging/lustre/lustre/osc/osc_io.c +9 -17
@@ -509,12 +509,11 @@ static void osc_io_setattr_end(const struct lu_env *env,static int osc_io_read_start (const struct lu_env *env,const struct cl_io_slice *slice) { -struct osc_io *oio =cl2osc_io (env, slice);struct cl_object *obj = slice->cis_obj;struct cl_attr *attr = &osc_env_info (env)->oti_attr;int rc =0 ; -if (oio->oi_lockless ==0 && !slice->cis_io->ci_noatime) { +if (!slice->cis_io->ci_noatime) {cl_object_attr_lock (obj); attr->cat_atime =LTIME_S (CURRENT_TIME ); rc =cl_object_attr_set (env, obj, attr,CAT_ATIME );
@@ -526,24 +525,17 @@ static int osc_io_read_start(const struct lu_env *env,static int osc_io_write_start (const struct lu_env *env,const struct cl_io_slice *slice) { -struct osc_io *oio =cl2osc_io (env, slice);struct cl_object *obj = slice->cis_obj;struct cl_attr *attr = &osc_env_info (env)->oti_attr; -int result =0 ; +int rc =0 ; -if (oio->oi_lockless ==0 ) { -OBD_FAIL_TIMEOUT (OBD_FAIL_OSC_DELAY_SETTIME ,1 ); -cl_object_attr_lock (obj); - result =cl_object_attr_get (env, obj, attr); -if (result ==0 ) { - attr->cat_mtime = attr->cat_ctime = -LTIME_S (CURRENT_TIME ); - result =cl_object_attr_set (env, obj, attr, -CAT_MTIME |CAT_CTIME ); - } -cl_object_attr_unlock (obj); - } -return result; +OBD_FAIL_TIMEOUT (OBD_FAIL_OSC_DELAY_SETTIME ,1 ); +cl_object_attr_lock (obj); + attr->cat_mtime = attr->cat_ctime =LTIME_S (CURRENT_TIME ); + rc =cl_object_attr_set (env, obj, attr,CAT_MTIME |CAT_CTIME ); +cl_object_attr_unlock (obj); + +return rc; } static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
Signature · 1 line
1.8.5.3
PATCH 44/47 staging/lustre: Always clamp cdls_delay between min and max
In reply to Oleg DrokinFrom: Ryan Haasken <[email protected]>
In libcfs_debug_vmsg2, cdls_delay is only clamped between the minimum and the maximum when it is increased by multiplying by the backoff factor. It is not clamped when it is decreased by dividing by the backoff factor. This allows it to achieve values less than the minimum, which allows a console message to be printed that should have been skipped. This patch moves the clamping outside of the else statement, ensuring that cdls_delay is always between the min and the max after the first time through libcfs_debug_vmsg2.
Reviewed-on: http://review.whamcloud.com/9503
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4711
--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/libcfs/tracefile.c +5 -5
@@ -416,13 +416,13 @@ console: cdls->cdls_delay /= libcfs_console_backoff *4 ; }else { cdls->cdls_delay *= libcfs_console_backoff; - -if (cdls->cdls_delay < libcfs_console_min_delay) - cdls->cdls_delay = libcfs_console_min_delay; -else if (cdls->cdls_delay > libcfs_console_max_delay) - cdls->cdls_delay = libcfs_console_max_delay; } +if (cdls->cdls_delay < libcfs_console_min_delay) + cdls->cdls_delay = libcfs_console_min_delay; +else if (cdls->cdls_delay > libcfs_console_max_delay) + cdls->cdls_delay = libcfs_console_max_delay; +/* ensure cdls_next is never zero after it's been seen */ cdls->cdls_next = (cfs_time_current () + cdls->cdls_delay) |1 ; }
Signature · 1 line
1.8.5.3
PATCH 45/47 staging/lustre: pass fsync() range through RPC/IO stack
In reply to Oleg DrokinFrom: Andreas Dilger <[email protected]>
The Linux VFS and Lustre OST_SYNC RPC are both capable of specifying fsync() on a sub-extent of the file {start, end} instead of the full file. This allows less than the full amount of data to be flushed, reducing or possibly eliminating the work needed before the syscall can return.
However, the handling of sub-extent of the file for fsync was lost with the move to CLIO on the client and OSD API on the server. They were ignoring the passed {start, end} and using {0, OBD_OBJECT_EOF} instead.
Return the ability to pass a sub-extent for fsync() from the client, to the specific stripes/OSTs that need the sync operation, and pass it down to the OSD. The ZFS OSD doesn't handle this yet, but there is room for improvement in a separate patch.
Reviewed-on: http://review.whamcloud.com/8626
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4388
--- drivers/staging/lustre/lustre/include/dt_object.h | 9 +++++---- drivers/staging/lustre/lustre/llite/file.c | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/include/dt_object.h +5 -4
@@ -441,7 +441,8 @@ struct dt_object_operations {struct dt_object *dt, struct lustre_capa *old, __u64 opc); -int (*do_object_sync)(const struct lu_env *,struct dt_object *); +int (*do_object_sync)(const struct lu_env *env,struct dt_object *obj, +__u64 start,__u64 end);/** * Get object info of next level. Currently, only get inode from osd. * This is only used by quota b=16542
@@ -900,13 +901,13 @@ static inline int dt_object_lock(const struct lu_env *env,int dt_lookup_dir (const struct lu_env *env,struct dt_object *dir,const char *name,struct lu_fid *fid); -static inline int dt_object_sync (const struct lu_env *env, -struct dt_object *o) +static inline int dt_object_sync (const struct lu_env *env,struct dt_object *o, +__u64 start,__u64 end) {LASSERT (o);LASSERT (o->do_ops);LASSERT (o->do_ops->do_object_sync); -return o->do_ops->do_object_sync (env, o); +return o->do_ops->do_object_sync (env, o, start, end); } int dt_declare_version_set(const struct lu_env *env, struct dt_object *o,
drivers/staging/lustre/lustre/llite/file.c +2 -3
@@ -2570,7 +2570,7 @@ static int ll_flush(struct file *file, fl_owner_t id)/** * Called to make sure a portion of file has been written out. -* if @local_only is not true, it will send OST_SYNC RPCs to ost. +* if @mode is not CL_FSYNC_LOCAL, it will send OST_SYNC RPCs to OST. * * Return how many pages have been written. */
@@ -2667,8 +2667,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)if (S_ISREG (inode->i_mode)) {struct ll_file_data *fd =LUSTRE_FPRIVATE (file); - err =cl_sync_file_range (inode,0 ,OBD_OBJECT_EOF , -CL_FSYNC_ALL ,0 ); + err =cl_sync_file_range (inode, start, end,CL_FSYNC_ALL ,0 );if (rc ==0 && err <0 ) rc = err;if (rc <0 )
Signature · 1 line
1.8.5.3
PATCH 46/47 staging/lustre: Fix unsafe userspace access in many proc files
In reply to Oleg DrokinApparently we are pretty bad about verifying our buffers passed from userspace.
Reviewed-on: http://review.whamcloud.com/9059
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4563
--- drivers/staging/lustre/lustre/fid/lproc_fid.c | 41 +++++++--- .../lustre/lustre/include/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 91 +++++++++++++++++----- .../lustre/lustre/obdclass/linux/linux-module.c | 9 ++- drivers/staging/lustre/lustre/osc/lproc_osc.c | 16 +++- 5 files changed, 124 insertions(+), 35 deletions(-)
drivers/staging/lustre/lustre/fid/lproc_fid.c +29 -12
@@ -54,32 +54,49 @@#include <lustre_fid.h> #include "fid_internal.h" +/* Format: [0x64BIT_INT - 0x64BIT_INT] + 32 bytes just in case */ +#define MAX_FID_RANGE_STRLEN (32 + 2 * 2 * sizeof(__u64))/* * Note: this function is only used for testing, it is no safe for production * use. */ -static int -lprocfs_fid_write_common (const char *buffer,unsigned long count, -struct lu_seq_range *range) +static int lprocfs_fid_write_common (const char __user *buffer,size_t count, +struct lu_seq_range *range) {struct lu_seq_range tmp;int rc; +char kernbuf[MAX_FID_RANGE_STRLEN ];LASSERT (range !=NULL ); - rc =sscanf (buffer,"[%llx - %llx]\n" , +if (count >=sizeof (kernbuf)) +return -EINVAL ; + +if (copy_from_user (kernbuf, buffer, count)) +return -EFAULT ; + + kernbuf[count] =0 ; + +if (count ==5 &&strcmp (kernbuf,"clear" ) ==0 ) { +memset (range,0 ,sizeof (*range)); +return count; + } + +/* of the form "[0x0000000240000400 - 0x000000028000400]" */ + rc =sscanf (kernbuf,"[%llx - %llx]\n" , (long long unsigned *)&tmp.lsr_start, (long long unsigned *)&tmp.lsr_end); -if (rc !=2 || !range_is_sane (&tmp) ||range_is_zero (&tmp)) +if (!range_is_sane (&tmp) ||range_is_zero (&tmp) || + tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end)return -EINVAL ; *range = tmp; -return 0 ; +return count; }/* Client side procfs stuff */ -static ssize_t -lprocfs_fid_space_seq_write (struct file *file,const char *buffer, -size_t count,loff_t *off) +static ssize_t lprocfs_fid_space_seq_write (struct file *file, +const char __user *buffer, +size_t count,loff_t *off) {struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private;int rc;
@@ -114,9 +131,9 @@ lprocfs_fid_space_seq_show(struct seq_file *m, void *unused)return rc; } -static ssize_t -lprocfs_fid_width_seq_write (struct file *file,const char *buffer, -size_t count,loff_t *off) +static ssize_t lprocfs_fid_width_seq_write (struct file *file, +const char __user *buffer, +size_t count,loff_t *off) {struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private;__u64 max;
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +1 -1
@@ -265,7 +265,7 @@ static inline __u64 range_space(const struct lu_seq_range *range)static inline void range_init (struct lu_seq_range *range) { - range->lsr_start = range->lsr_end = range->lsr_index =0 ; +memset (range,0 ,sizeof (*range)); }/**
drivers/staging/lustre/lustre/llite/lproc_llite.c +73 -18
156 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +8 -1
@@ -279,8 +279,15 @@ static ssize_t obd_proc_jobid_var_seq_write(struct file *file, const char *buffereturn -EINVAL ;memset (obd_jobid_var,0 ,JOBSTATS_JOBID_VAR_MAX_LEN +1 ); + +/* This might leave the var invalid on error, which is probably fine.*/ +if (copy_from_user (obd_jobid_var, buffer, count)) +return -EFAULT ; +/* Trim the trailing '\n' if any */ -memcpy (obd_jobid_var, buffer, count - (buffer[count -1 ] =='\n' )); +if (obd_jobid_var[count -1 ] =='\n' ) + obd_jobid_var[count -1 ] =0 ; +return count; }LPROC_SEQ_FOPS (obd_proc_jobid_var);
drivers/staging/lustre/lustre/osc/lproc_osc.c +13 -3
@@ -174,15 +174,25 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v) }/* shrink the number of caching pages to a specific number */ -static ssize_t osc_cached_mb_seq_write (struct file *file,const char *buffer, -size_t count,loff_t *off) +static ssize_t osc_cached_mb_seq_write (struct file *file, +const char __user *buffer, +size_t count,loff_t *off) {struct obd_device *dev = ((struct seq_file *)file->private_data)->private;struct client_obd *cli = &dev->u.cli;int pages_number, mult, rc; +char kernbuf[128 ]; + +if (count >=sizeof (kernbuf)) +return -EINVAL ; + +if (copy_from_user (kernbuf, buffer, count)) +return -EFAULT ; + kernbuf[count] =0 ; mult =1 << (20 -PAGE_CACHE_SHIFT ); - buffer =lprocfs_find_named_value (buffer,"used_mb:" , &count); + buffer +=lprocfs_find_named_value (kernbuf,"used_mb:" , &count) - + kernbuf; rc =lprocfs_write_frac_helper (buffer, count, &pages_number, mult);if (rc)return rc;
Signature · 1 line
1.8.5.3
Greg Kroah-Hartman
maintainerRe: [PATCH 46/47] staging/lustre: Fix unsafe userspace access in many proc files
Quoted 2 lines · Oleg Drokin
Apparently we are pretty bad about verifying our buffers passed from userspace.
Understatement of the day...
PATCH 47/47 staging/lustre/llite: prevent buffer overflow in fiemap
In reply to Oleg DrokinFrom: Bobi Jam <[email protected]>
lov_fiemap() does not take consider its @vallen parameter, which is the max buffer size the caller can hold for the fiemap extents.
This patch fixes this and limits the max mapped fiemap extent count to fit in the preallocted buffer.
This patch also fixes a memory out of bound write issue when the fiemap call is only for detecting the number of existing extent.
Reviewed-on: http://review.whamcloud.com/9834
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4619
--- drivers/staging/lustre/lustre/llite/file.c | 15 +++++++++------ drivers/staging/lustre/lustre/lov/lov_obd.c | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +9 -6
@@ -1721,12 +1721,12 @@ out:* Make the FIEMAP get_info call and returns the result. */ static int ll_do_fiemap (struct inode *inode,struct ll_user_fiemap *fiemap, -int num_bytes) +size_t num_bytes) {struct obd_export *exp =ll_i2dtexp (inode);struct lov_stripe_md *lsm =NULL ;struct ll_fiemap_info_key fm_key = { .name =KEY_FIEMAP , }; -int vallen = num_bytes; +__u32 vallen = num_bytes;int rc;/* Checks for fiemap flags */
@@ -3080,15 +3080,18 @@ static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, fiemap->fm_extent_count = fieinfo->fi_extents_max; fiemap->fm_start = start; fiemap->fm_length = len; -memcpy (&fiemap->fm_extents[0 ], fieinfo->fi_extents_start, -sizeof (struct ll_fiemap_extent )); +if (extent_count >0 ) +memcpy (&fiemap->fm_extents[0 ], fieinfo->fi_extents_start, +sizeof (struct ll_fiemap_extent )); rc =ll_do_fiemap (inode, fiemap, num_bytes); fieinfo->fi_flags = fiemap->fm_flags; fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents; -memcpy (fieinfo->fi_extents_start, &fiemap->fm_extents[0 ], - fiemap->fm_mapped_extents *sizeof (struct ll_fiemap_extent )); +if (extent_count >0 ) +memcpy (fieinfo->fi_extents_start, &fiemap->fm_extents[0 ], + fiemap->fm_mapped_extents * +sizeof (struct ll_fiemap_extent ));OBD_FREE_LARGE (fiemap, num_bytes);return rc;
drivers/staging/lustre/lustre/lov/lov_obd.c +2 -1
@@ -2248,11 +2248,12 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key,if (fm_end_offset == -EINVAL )GOTO (out, rc = -EINVAL ); +if (fiemap_count_to_size (fiemap->fm_extent_count) > *vallen) + fiemap->fm_extent_count =fiemap_size_to_count (*vallen);if (fiemap->fm_extent_count ==0 ) { get_num_extents =1 ; count_local =0 ; } -/* Check each stripe */ for (cur_stripe = start_stripe, i =0 ; i < stripe_count; i++, cur_stripe = (cur_stripe +1 ) % lsm->lsm_stripe_count) {
Signature · 1 line
1.8.5.3
Greg Kroah-Hartman
maintainerQuoted 8 lines · Oleg Drokin
Hello!
This pile of patches brings in most of the recent fixes from current Lustre development tree, also code cleanups, junk removal and such.
A relatively unsynced area remaining is in client io stack that is undergoing some major shakeups now, I'll try to tackle it later once things actually settle down some more.
I've applied these, except for the 3 gss patches.
Also, there is now a build warning in the tree thanks to these, please send a follow-on patch to fix it before you get an email from the 0-day bot about it.
Quoted 10 lines
There are several checkpatch warnings in this patchset that I am not sure what to do aobut since the messages printed are genuinely long:
WARNING: quoted string split across lines
#61: FILE:drivers/staging/lustre/lustre/ptlrpc/import.c:1424:(quoted diff) +2
-0+ CERROR("%s: don't know how to disconnect from %s " + "(connect_op %d): rc = %d\n",total: 0 errors, 1 warnings, 73 lines checked
Strings all need to go on one line, and you all need to take out your "special" logging macros so that checkpatch will know what to do with them.
thanks,
greg k-h
Hello!
Quoted 1 line · Greg Kroah-Hartman
I've applied these, except for the 3 gss patches.
Thanks.
gss stuff was kind of totally separate, tso I thought it was not so bad idea to include them, but they are definitely not required.
Quoted 3 lines
Also, there is now a build warning in the tree thanks to these, please send a follow-on patch to fix it before you get an email from the 0-day bot about it.
This one? I was under impression it was there before the pile of the patches as lustre/llite/symlink.c was last touched back in March and none of my patches touch it. I'll have a patch for it shortly.
In file included from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lustre_compat25.h:41:0,
from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lvfs.h:48, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/lvfs.h:45, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/obd_support.h:41, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/obd_class.h:40, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:49, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c:42:
/home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c: In function Б─≤ll_follow_linkБ─≥:
/home/green/bk/linux/include/linux/namei.h:88:29: warning: Б─≤symnameБ─≥ may be used uninitialized in this function [-Wmaybe-uninitialized]
nd->saved_names[nd->depth] = path;
^
/home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c:123:8: note: Б─≤symnameБ─≥ was declared here
char *symname;
^Bye,
Oleg