Update to OpenSFS tree as of May 3, 2021
cover Update to OpenSFS tree as of May 3, 2021
Port the latest work from the OpenSFS tree to the native Linux client as of May 4, 2021. This now includes the fake symlink DOAS work.
Alex Zhuravlev (1):
lustre: mdc: make rpc set for MDS_STATFS interruptible
Alexander Boyko (1):
lustre: ptlrpc: idle import vs lock enqueue race
Andreas Dilger (1):
lustre: mdc: include linux/idr.h for referenced code
Bruno Faccini (1):
lustre: llite: fake symlink type of foreign file/dir
Chris Horn (5):
lnet: Recover local NI w/exponential backoff interval
lnet: Deprecate lnet_recovery_interval
lnet: Router ping timeout with discovery disabled
lnet: Ensure proper peer, peer NI, peer net hierarchy
lnet: Skip discovery in LNetPrimaryNID if DD disabled
Mr NeilBrown (4):
lnet: libcfs: simplify task management in tracefile.c
lustre: move lu_tgt_pool out of obd_target.h
lnet: libcfs: remove references to Sun Trademark.
lustre: llite: use d_is_symlink to test if dentry is a symlink
Patrick Farrell (1):
lustre: llite: Remove last lockahead old compat
fs/lustre/include/lu_object.h | 18 +- fs/lustre/include/lustre_net.h | 1 + fs/lustre/include/obd_class.h | 2 + fs/lustre/include/obd_support.h | 1 + fs/lustre/include/obd_target.h | 53 --- fs/lustre/llite/Makefile | 1 + fs/lustre/llite/dcache.c | 14 +- fs/lustre/llite/dir.c | 11 + fs/lustre/llite/file.c | 53 ++- fs/lustre/llite/foreign_symlink.h | 49 +++ fs/lustre/llite/llite_foreign.c | 284 ++++++++++++ fs/lustre/llite/llite_foreign_symlink.c | 758 ++++++++++++++++++++++++++++++++ fs/lustre/llite/llite_internal.h | 35 +- fs/lustre/llite/llite_lib.c | 105 +++++ fs/lustre/llite/lproc_llite.c | 12 + fs/lustre/llite/namei.c | 33 +- fs/lustre/llite/pcc.c | 4 +- fs/lustre/llite/symlink.c | 1 + fs/lustre/lov/lov_object.c | 3 +- fs/lustre/lov/lov_pack.c | 13 +- fs/lustre/mdc/mdc_changelog.c | 1 + fs/lustre/mdc/mdc_request.c | 1 + fs/lustre/obdclass/lu_tgt_pool.c | 2 +- fs/lustre/obdclass/obd_mount.c | 4 +- fs/lustre/osc/osc_lock.c | 5 + fs/lustre/ptlrpc/client.c | 11 + fs/lustre/ptlrpc/import.c | 63 ++- fs/lustre/ptlrpc/pinger.c | 5 +- include/linux/libcfs/libcfs.h | 1 - include/linux/libcfs/libcfs_cpu.h | 1 - include/linux/libcfs/libcfs_debug.h | 1 - include/linux/libcfs/libcfs_hash.h | 1 - include/linux/libcfs/libcfs_private.h | 1 - include/linux/libcfs/libcfs_string.h | 1 - include/linux/lnet/lib-lnet.h | 9 + include/linux/lnet/lib-types.h | 7 + include/uapi/linux/lustre/lustre_user.h | 49 ++- net/lnet/libcfs/debug.c | 1 - net/lnet/libcfs/hash.c | 1 - net/lnet/libcfs/libcfs_cpu.c | 1 - net/lnet/libcfs/libcfs_lock.c | 1 - net/lnet/libcfs/libcfs_mem.c | 1 - net/lnet/libcfs/libcfs_string.c | 1 - net/lnet/libcfs/module.c | 1 - net/lnet/libcfs/tracefile.c | 83 ++-- net/lnet/libcfs/tracefile.h | 1 - net/lnet/lnet/api-ni.c | 26 +- net/lnet/lnet/lib-move.c | 60 +-- net/lnet/lnet/lib-msg.c | 48 +- net/lnet/lnet/peer.c | 55 ++- net/lnet/lnet/router.c | 8 +- 51 files changed, 1640 insertions(+), 262 deletions(-) delete mode 100644 fs/lustre/include/obd_target.h create mode 100644 fs/lustre/llite/foreign_symlink.h create mode 100644 fs/lustre/llite/llite_foreign.c create mode 100644 fs/lustre/llite/llite_foreign_symlink.c
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 1/14 lustre: llite: Remove last lockahead old compat
From: Patrick Farrell <[email protected]>
The CEF_NONBLOCK flag in cld_enq_flags is required for the old Cray-only server release of lockahead. In the more recent versions, the required nonblocking behavior (on the server side) is associated with LDLM_FL_SPECULATIVE, not with the combination of LDLM_FL_NO_EXPAND and LDLM_FL_BLOCK_NOWAIT (as was done in the old implementation).
Now we control 'speculative' or not with the async flag from userspace.
Now that we've removed OBD_CONNECT_LOCKAHEAD_OLD support from the client, we should be good to go there.
The existing testing explores both sync and async requests, and should be enough to verify this is OK.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6179
Lustre-commit: 12a0c7b5944d9e48 ("LU-6179 llite: Remove last lockahead old compat")
Reviewed-on: https://review.whamcloud.com/38179
--- fs/lustre/llite/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/lustre/llite/file.c +1 -2
@@ -3033,8 +3033,7 @@ int ll_file_lock_ahead(struct file *file, struct llapi_lu_ladvise *ladvise)/* CEF_MUST is used because we do not want to convert a * lockahead request to a lockless lock */ - descr->cld_enq_flags =CEF_MUST |CEF_LOCK_NO_EXPAND | -CEF_NONBLOCK ; + descr->cld_enq_flags =CEF_MUST |CEF_LOCK_NO_EXPAND ;if (ladvise->lla_peradvice_flags &LF_ASYNC ) descr->cld_enq_flags |=CEF_SPECULATIVE ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 2/14 lustre: mdc: include linux/idr.h for referenced code
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Include the <linux/idr.h> header in files that references IDR functionality. Don't depend on its indirect inclusion elsewhere.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: 3589a3141a4b9f94 ("LU-6142 mdc: include linux/idr.h for referenced code")
Reviewed-on: https://review.whamcloud.com/43346
--- fs/lustre/mdc/mdc_changelog.c | 1 + 1 file changed, 1 insertion(+)
fs/lustre/mdc/mdc_changelog.c +1 -0
@@ -36,6 +36,7 @@#include <linux/poll.h> #include <linux/device.h> #include <linux/cdev.h> +#include <linux/idr.h> #include <lustre_log.h> #include <uapi/linux/lustre/lustre_ioctl.h>
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 3/14 lnet: Recover local NI w/exponential backoff interval
In reply to James SimmonsFrom: Chris Horn <[email protected]>
Use an exponential backoff algorithm to determine the interval at which unhealthy local NIs are ping'd
Introduce lnet_ni_add_to_recoveryq_locked() which handles checking pre-conditions for whether the NI should be added to the recovery queue, and takes a ref on the NI as appropriate.
HPE-bug-id: LUS-9109
WC-bug-id: https://jira.whamcloud.com/browse/LU-13569
Lustre-commit: 8fdf2bc62ac9c418 ("LU-13569 lnet: Recover local NI w/exponential backoff interval")
Reviewed-on: https://review.whamcloud.com/39721
--- include/linux/lnet/lib-lnet.h | 9 ++++++++ include/linux/lnet/lib-types.h | 7 ++++++ net/lnet/lnet/lib-move.c | 41 ++++++++++++++++++------------------ net/lnet/lnet/lib-msg.c | 48 +++++++++++++++++++++++++++--------------- 4 files changed, 67 insertions(+), 38 deletions(-)
include/linux/lnet/lib-lnet.h +9 -0
@@ -518,6 +518,9 @@ extern void lnet_peer_ni_add_to_recoveryq_locked(struct lnet_peer_ni *lpni,extern int lnet_peer_del_pref_nid (struct lnet_peer_ni *lpni,lnet_nid_t nid);void lnet_peer_ni_set_selection_priority (struct lnet_peer_ni *lpni,u32 priority); +extern void lnet_ni_add_to_recoveryq_locked (struct lnet_ni *ni, +struct list_head *queue, +time64_t now);void lnet_router_debugfs_init (void );void lnet_router_debugfs_fini (void );
@@ -929,6 +932,12 @@ int lnet_get_peer_ni_info(u32 peer_index, u64 *nid,lnet_get_next_recovery_ping (lpni->lpni_ping_count, now); } +static inline void +lnet_ni_set_next_ping (struct lnet_ni *ni,time64_t now) +{ + ni->ni_next_ping =lnet_get_next_recovery_ping (ni->ni_ping_count, now); +} +/* * A peer NI is alive if it satisfies the following two conditions: * 1. peer NI health >= LNET_MAX_HEALTH_VALUE * router_sensitivity_percentage
include/linux/lnet/lib-types.h +7 -0
@@ -460,6 +460,13 @@ struct lnet_ni {/* Recovery state. Protected by lnet_ni_lock() */ u32 ni_recovery_state; +/* When to send the next recovery ping */ +time64_t ni_next_ping; +/* How many pings sent during current recovery period did not receive +* a reply. NB: reset whenever _any_ message arrives on this NI +*/ +unsigned int ni_ping_count; +/* per NI LND tunables */ struct lnet_lnd_tunables ni_lnd_tunables;
net/lnet/lnet/lib-move.c +20 -21
69 lines not on this page · raw message
net/lnet/lnet/lib-msg.c +31 -17
79 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 4/14 lnet: Deprecate lnet_recovery_interval
In reply to James SimmonsFrom: Chris Horn <[email protected]>
We no longer use a static recovery interval, so remove its remaining uses and add warning that it has been deprecated.
HPE-bug-id: LUS-9109
C-bug-id: https://jira.whamcloud.com/browse/LU-13569
Lustre-commit: 79ab0535622782c82 ("LU-13569 lnet: Deprecate lnet_recovery_interval")
Reviewed-on: https://review.whamcloud.com/39722
--- net/lnet/lnet/api-ni.c | 26 ++------------------------ net/lnet/lnet/lib-move.c | 19 +++---------------- 2 files changed, 5 insertions(+), 40 deletions(-)
net/lnet/lnet/api-ni.c +2 -24
@@ -110,7 +110,7 @@ static int recovery_interval_set(const char *val, __param_check(name, p, int)module_param (lnet_recovery_interval, recovery_interval,0644 );MODULE_PARM_DESC (lnet_recovery_interval, -"Interval to recover unhealthy interfaces in seconds" ); +"DEPRECATED Interval to recover unhealthy interfaces in seconds" );unsigned int lnet_recovery_limit;module_param (lnet_recovery_limit, uint,0644 );
@@ -253,29 +253,7 @@ static int lnet_discover(struct lnet_process_id id, u32 force,static int recovery_interval_set (const char *val,const struct kernel_param *kp) { -int rc; -unsigned int *interval = (unsigned int *)kp->arg; -unsigned long value; - - rc =kstrtoul (val,0 , &value); -if (rc) { -CERROR ("Invalid module parameter value for 'lnet_recovery_interval'\n" ); -return rc; - } - -if (value <1 ) { -CERROR ("lnet_recovery_interval must be at least 1 second\n" ); -return -EINVAL ; - } - -/* The purpose of locking the api_mutex here is to ensure that -* the correct value ends up stored properly. -*/ -mutex_lock (&the_lnet.ln_api_mutex); - - *interval = value; - -mutex_unlock (&the_lnet.ln_api_mutex); +CWARN ("'lnet_recovery_interval' has been deprecated\n" );return 0 ; }
net/lnet/lnet/lib-move.c +3 -16
@@ -3480,9 +3480,7 @@ struct lnet_mt_event_info {static int lnet_monitor_thread (void *arg) { -time64_t recovery_timeout =0 ;time64_t rsp_timeout =0 ; -int interval;time64_t now;wait_for_completion (&the_lnet.ln_started);
@@ -3509,11 +3507,8 @@ struct lnet_mt_event_info { rsp_timeout = now + (lnet_transaction_timeout /2 ); } -if (now >= recovery_timeout) { -lnet_recover_local_nis (); -lnet_recover_peer_nis (); - recovery_timeout = now + lnet_recovery_interval; - } +lnet_recover_local_nis (); +lnet_recover_peer_nis ();/* TODO do we need to check if we should sleep without * timeout? Technically, an active system will always
@@ -3522,17 +3517,9 @@ struct lnet_mt_event_info {* if we wake up every 1 second? Although, we've seen * cases where we get a complaint that an idle thread * is waking up unnecessarily. -* -* Take into account the current net_count when you wake -* up for alive router checking, since we need to check -* possibly as many networks as we have configured. */ - interval =min (lnet_recovery_interval, -min ((unsigned int )alive_router_check_interval / - lnet_current_net_count, - lnet_transaction_timeout /2 ));wait_for_completion_interruptible_timeout (&the_lnet.ln_mt_wait_complete, - interval *HZ ); +HZ );/* Must re-init the completion before testing anything, * including ln_mt_state. */
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 5/14 lnet: Router ping timeout with discovery disabled
In reply to James SimmonsFrom: Chris Horn <[email protected]>
Discovery pings are used to determine the health of gateways and associated routes. Ping replies from gateways with dynamic discovery (DD) disabled (or if DD is disabled locally) are handled in a special routine, lnet_router_discovery_ping_reply(), but this function and related code doesn't handle the case where a discovery ping hits the response tracker timeout and is unlinked by the monitor thread. In this case, an UNLINK event is generated and we do not call the lnet_router_discovery_ping_reply(). For gateways with DD enabled (and DD enabled locally), we handle this case in lnet_router_discovery_complete(). If discovery failed then lp_dc_error is set and we mark all routes down for the gateway. We can simply extend this logic to the case of gateways w/DD disabled (or DD disabled locally).
HPE-bug-id: LUS-9612
WC-bug-id: https://jira.whamcloud.com/browse/LU-14206
Lustre-commit: 173d86c6e9a704a8 ("LU-14206 lnet: Router ping timeout with discovery disabled")
Reviewed-on: https://review.whamcloud.com/40923
--- net/lnet/lnet/router.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/lnet/lnet/router.c +4 -4
@@ -495,11 +495,11 @@ bool lnet_is_route_alive(struct lnet_route *route) lp->lp_alive = lp->lp_dc_error ==0 ;spin_unlock (&lp->lp_lock); -/* ping replies are being handled when discovery is disabled */ -if (lnet_is_discovery_disabled_locked (lp)) -return ; -if (!lp->lp_dc_error) { +/* ping replies are being handled when discovery is disabled */ +if (lnet_is_discovery_disabled_locked (lp)) +return ; +/* mark single-hop routes. If the remote net is not configured * on the gateway we assume this is intentional and we mark the * gateway as multi-hop
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 6/14 lnet: Ensure proper peer, peer NI, peer net hierarchy
In reply to James SimmonsFrom: Chris Horn <[email protected]>
The MR design dictates that the peer nets and peer NIs are ordered such that the peer net and peer NI for a peer's primary NID appears first, followed by other peer NIs in the primary NID's peer net, followed by other peer nets/NIs. This ordering is broken and it can result in tripping an assertion if the primary NID of a peer is deleted. Modify lnet_peer_attach_peer_ni() to check whether the NI being attached is the peer's primary, and place it, and its associated peer net, appropriately.
Modify lnet_peer_set_primary_nid() so that it updates the lp_primary_nid before calling lnet_peer_add_nid() so that lnet_peer_attach_peer_ni() can detect the situation where the primary is changing and act appropriately.
Finally, modify lnet_peer_merge_data() to enforce the hierarchy after it has finished merging the contents of the ping buffer. This ensures we maintain the correct hierarchy in certain edge cases where we've needed to reconcile two peers. e.g. if a peer adds a new interface, the discovery push may arrive from that new interface which will result in a second peer object being created which will need to be reconciled with the original peer object.
HPE-bug-id: LUS-9630
WC-bug-id: https://jira.whamcloud.com/browse/LU-13806
Lustre-commit: 9eb9474c41c823c7 ("LU-13806 lnet: Ensure proper peer, peer NI, peer net hierarchy")
Reviewed-on: https://review.whamcloud.com/40985
--- net/lnet/lnet/peer.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)
net/lnet/lnet/peer.c +37 -4
@@ -1428,7 +1428,10 @@ struct lnet_peer_net */* Add peer_ni to peer_net */ lpni->lpni_peer_net = lpn; -list_add_tail (&lpni->lpni_peer_nis, &lpn->lpn_peer_nis); +if (lp->lp_primary_nid == lpni->lpni_nid) +list_add (&lpni->lpni_peer_nis, &lpn->lpn_peer_nis); +else +list_add_tail (&lpni->lpni_peer_nis, &lpn->lpn_peer_nis);lnet_update_peer_net_healthv (lpni);lnet_peer_net_addref_locked (lpn);
@@ -1436,7 +1439,10 @@ struct lnet_peer_net *if (!lpn->lpn_peer) { new_lpn = true; lpn->lpn_peer = lp; -list_add_tail (&lpn->lpn_peer_nets, &lp->lp_peer_nets); +if (lp->lp_primary_nid == lpni->lpni_nid) +list_add (&lpn->lpn_peer_nets, &lp->lp_peer_nets); +else +list_add_tail (&lpn->lpn_peer_nets, &lp->lp_peer_nets);lnet_peer_addref_locked (lp); }
@@ -1678,10 +1684,14 @@ struct lnet_peer_net *if (lp->lp_primary_nid == nid) goto out; + + lp->lp_primary_nid = nid; + rc =lnet_peer_add_nid (lp, nid, flags); -if (rc) +if (rc) { + lp->lp_primary_nid = old; goto out; - lp->lp_primary_nid = nid; + } out:CDEBUG (D_NET ,"peer %s NID %s: %d\n" ,libcfs_nid2str (old),libcfs_nid2str (nid), rc);
@@ -2777,6 +2787,7 @@ static void lnet_discovery_event_handler(struct lnet_event *event)static int lnet_peer_merge_data (struct lnet_peer *lp,struct lnet_ping_buffer *pbuf) { +struct lnet_peer_net *lpn;struct lnet_peer_ni *lpni;lnet_nid_t *curnis =NULL ;struct lnet_ni_status *addnis =NULL ;
@@ -2902,6 +2913,28 @@ static int lnet_peer_merge_data(struct lnet_peer *lp, goto out; } } + +/* The peer net for the primary NID should be the first entry in the +* peer's lp_peer_nets list, and the peer NI for the primary NID should +* be the first entry in its peer net's lpn_peer_nis list. +*/ + lpni =lnet_find_peer_ni_locked (pbuf->pb_info.pi_ni[1 ].ns_nid); +if (!lpni) { +CERROR ("Internal error: Failed to lookup peer NI for primary NID: %s\n" , +libcfs_nid2str (pbuf->pb_info.pi_ni[1 ].ns_nid)); + goto out; + } + +lnet_peer_ni_decref_locked (lpni); + + lpn = lpni->lpni_peer_net; +if (lpn->lpn_peer_nets.prev != &lp->lp_peer_nets) +list_move (&lpn->lpn_peer_nets, &lp->lp_peer_nets); + +if (lpni->lpni_peer_nis.prev != &lpni->lpni_peer_net->lpn_peer_nis) +list_move (&lpni->lpni_peer_nis, + &lpni->lpni_peer_net->lpn_peer_nis); +/* * Errors other than -ENOMEM are due to peers having been * configured with DLC. Ignore these because DLC overrides
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 7/14 lnet: libcfs: simplify task management in tracefile.c
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
The waitqueue, mutex, and two completions are not needed. We can use kthread_stop/kthread_should_stop to synchronize shutdown, cmpxchg() to ensure only one task is started, and a simple wake_up_process() to wake the process.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14428
Lustre-commit: 6c5e6dd777a49ab0 ("LU-14428 libcfs: simplify task management in tracefile.c")
Reviewed-on: https://review.whamcloud.com/41492
--- net/lnet/libcfs/tracefile.c | 82 ++++++++++++++------------------------------- 1 file changed, 26 insertions(+), 56 deletions(-)
net/lnet/libcfs/tracefile.c +26 -56
@@ -61,9 +61,8 @@ enum cfs_trace_buf_type {char cfs_tracefile[TRACEFILE_NAME_SIZE ];long long cfs_tracefile_size =CFS_TRACEFILE_SIZE ; -static struct tracefiled_ctl trace_tctl; -static DEFINE_MUTEX (cfs_trace_thread_mutex); -static int thread_running; + +struct task_struct *tctl_task;static atomic_t cfs_tage_allocated =ATOMIC_INIT (0 );static DECLARE_RWSEM (cfs_tracefile_sem);
@@ -78,14 +77,6 @@ struct page_collection {int pc_want_daemon_pages; }; -struct tracefiled_ctl { -struct completion tctl_start; -struct completion tctl_stop; -wait_queue_head_t tctl_waitq; -pid_t tctl_pid; -atomic_t tctl_shutdown; -}; -/* * small data-structure for each page owned by tracefiled. */
@@ -244,6 +235,7 @@ static void cfs_tage_to_tail(struct cfs_trace_page *tage, cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len) {struct cfs_trace_page *tage; +struct task_struct *tsk;if (tcd->tcd_cur_pages >0 ) {__LASSERT (!list_empty (&tcd->tcd_pages));
@@ -274,12 +266,10 @@ static void cfs_tage_to_tail(struct cfs_trace_page *tage,list_add_tail (&tage->linkage, &tcd->tcd_pages); tcd->tcd_cur_pages++; -if (tcd->tcd_cur_pages >8 && thread_running) { -struct tracefiled_ctl *tctl = &trace_tctl; -/* -* wake up tracefiled to process some pages. +if (tcd->tcd_cur_pages >8 && tsk) { +/* wake up tracefiled to process some pages. */ -wake_up (&tctl->tctl_waitq); +wake_up_process (tsk); }return tage; }
@@ -332,7 +322,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, tage =cfs_trace_get_tage_try (tcd, len);if (tage)return tage; -if (thread_running) +if (tctl_task)cfs_tcd_shrink (tcd);if (tcd->tcd_cur_pages >0 ) { tage =cfs_tage_from_list (tcd->tcd_pages.next);
@@ -1075,7 +1065,6 @@ int cfs_trace_get_debug_mb(void)static int tracefiled (void *arg) {struct page_collection pc; -struct tracefiled_ctl *tctl = arg;struct cfs_trace_page *tage;struct cfs_trace_page *tmp;struct file *filp;
@@ -1083,21 +1072,13 @@ static int tracefiled(void *arg)int last_loop =0 ;int rc; -/* we're started late enough that we pick up init's fs context */ -/* this is so broken in uml? what on earth is going on? */ - -complete (&tctl->tctl_start); - pc.pc_want_daemon_pages =0 ;while (!last_loop) { -wait_event_timeout (tctl->tctl_waitq, - ({collect_pages (&pc); - !list_empty (&pc.pc_pages); }) || -atomic_read (&tctl->tctl_shutdown), -HZ ); -if (atomic_read (&tctl->tctl_shutdown)) +schedule_timeout_interruptible (HZ ); +if (kthread_should_stop ()) last_loop =1 ; +collect_pages (&pc);if (list_empty (&pc.pc_pages))continue ;
@@ -1168,50 +1149,39 @@ static int tracefiled(void *arg) }__LASSERT (list_empty (&pc.pc_pages)); } -complete (&tctl->tctl_stop); +return 0 ; }int cfs_trace_start_thread (void ) { -struct tracefiled_ctl *tctl = &trace_tctl; -struct task_struct *task; +struct task_struct *tsk;int rc =0 ; -mutex_lock (&cfs_trace_thread_mutex); -if (thread_running) - goto out; - -init_completion (&tctl->tctl_start); -init_completion (&tctl->tctl_stop); -init_waitqueue_head (&tctl->tctl_waitq); -atomic_set (&tctl->tctl_shutdown,0 ); +if (tctl_task) +return 0 ; - task =kthread_run (tracefiled, tctl,"ktracefiled" ); -if (IS_ERR (task)) { - rc =PTR_ERR (task); - goto out; - } + tsk =kthread_create (tracefiled,NULL ,"ktracefiled" ); +if (IS_ERR (tsk)) + rc =PTR_ERR (tsk); +else if (cmpxchg (&tctl_task,NULL , tsk)) +/* already running */ +kthread_stop (tsk); +else +wake_up_process (tsk); -wait_for_completion (&tctl->tctl_start); - thread_running =1 ; -out: -mutex_unlock (&cfs_trace_thread_mutex);return rc; }void cfs_trace_stop_thread (void ) { -struct tracefiled_ctl *tctl = &trace_tctl; +struct task_struct *tsk; -mutex_lock (&cfs_trace_thread_mutex); -if (thread_running) { + tsk =xchg (&tctl_task,NULL ); +if (tsk) {pr_info ("shutting down debug daemon thread...\n" ); -atomic_set (&tctl->tctl_shutdown,1 ); -wait_for_completion (&tctl->tctl_stop); - thread_running =0 ; +kthread_stop (tsk); } -mutex_unlock (&cfs_trace_thread_mutex); }/* percents to share the total debug memory for each type */
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 8/14 lustre: move lu_tgt_pool out of obd_target.h
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
'struct lu_tgt_pool' is the only part of obd_target.h that is needed on the client.
So move it and related declarations to lu_object.h.
Then obd_target.h does not need to be included by lu_object.h, and it will only be included server-side;
WC-bug-id: https://jira.whamcloud.com/browse/LU-8837
Lustre-commit: 5a8dc02609ace484 ("LU-8837 lustre: move lu_tgt_pool out of obd_target.h")
Reviewed-on: https://review.whamcloud.com/41951
--- fs/lustre/include/lu_object.h | 18 +++++++++++++- fs/lustre/include/obd_target.h | 53 ---------------------------------------- fs/lustre/obdclass/lu_tgt_pool.c | 2 +- 3 files changed, 18 insertions(+), 55 deletions(-) delete mode 100644 fs/lustre/include/obd_target.h
fs/lustre/include/lu_object.h +17 -1
@@ -38,7 +38,6 @@#include <linux/rhashtable.h> #include <linux/libcfs/libcfs.h> #include <linux/ctype.h> -#include <obd_target.h> #include <uapi/linux/lustre/lustre_idl.h> #include <lu_ref.h>
@@ -1404,6 +1403,23 @@ struct lu_kmem_descr {extern u32 lu_context_tags_default;extern u32 lu_session_tags_default; +/* Generic subset of tgts */ +struct lu_tgt_pool { +u32 *op_array;/* array of index of +* lov_obd->lov_tgts +*/ +unsigned int op_count;/* number of tgts in the array */ +unsigned int op_size;/* allocated size of op_array */ +struct rw_semaphore op_rw_sem;/* to protect lu_tgt_pool use */ +}; + +int tgt_pool_init (struct lu_tgt_pool *op,unsigned int count); +int tgt_pool_add (struct lu_tgt_pool *op,u32 idx,unsigned int min_count); +int tgt_pool_remove (struct lu_tgt_pool *op,u32 idx); +int tgt_pool_free (struct lu_tgt_pool *op); +int tgt_check_index (int idx,struct lu_tgt_pool *osts); +int tgt_pool_extend (struct lu_tgt_pool *op,unsigned int min_count); +/* bitflags used in rr / qos allocation */ enum lq_flag {LQ_DIRTY =0 ,/* recalc qos data */
fs/lustre/include/obd_target.h deleted +0 -53
53 lines not on this page · raw message
fs/lustre/obdclass/lu_tgt_pool.c +1 -1
@@ -42,8 +42,8 @@#define DEBUG_SUBSYSTEM S_CLASS#include <linux/libcfs/libcfs_private.h> -#include <obd_target.h> #include <obd_support.h> +#include <lu_object.h> /** * Initialize the pool data structures at startup.
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 9/14 lnet: libcfs: remove references to Sun Trademark.
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
"lustre" is no longer a Trademark of Sun Microsystems. There is no need to acknowledge the trademark in every file, so just remove all these claims.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14487
Lustre-commit: 6621439c371e37268 ("LU-14487 libcfs: remove references to Sun Trademark.")
Reviewed-on: https://review.whamcloud.com/42137
--- include/linux/libcfs/libcfs.h | 1 - include/linux/libcfs/libcfs_cpu.h | 1 - include/linux/libcfs/libcfs_debug.h | 1 - include/linux/libcfs/libcfs_hash.h | 1 - include/linux/libcfs/libcfs_private.h | 1 - include/linux/libcfs/libcfs_string.h | 1 - net/lnet/libcfs/debug.c | 1 - net/lnet/libcfs/hash.c | 1 - net/lnet/libcfs/libcfs_cpu.c | 1 - net/lnet/libcfs/libcfs_lock.c | 1 - net/lnet/libcfs/libcfs_mem.c | 1 - net/lnet/libcfs/libcfs_string.c | 1 - net/lnet/libcfs/module.c | 1 - net/lnet/libcfs/tracefile.c | 1 - net/lnet/libcfs/tracefile.h | 1 - 15 files changed, 15 deletions(-)
include/linux/libcfs/libcfs.h +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef __LIBCFS_LIBCFS_H__
include/linux/libcfs/libcfs_cpu.h +0 -1
@@ -23,7 +23,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/libcfs_cpu.h *
include/linux/libcfs/libcfs_debug.h +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/libcfs_debug.h *
include/linux/libcfs/libcfs_hash.h +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/libcfs_hash.h *
include/linux/libcfs/libcfs_private.h +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/libcfs_private.h *
include/linux/libcfs/libcfs_string.h +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/libcfs_string.h *
net/lnet/libcfs/debug.c +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/libcfs/debug.c *
net/lnet/libcfs/hash.c +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/libcfs/hash.c *
net/lnet/libcfs/libcfs_cpu.c +0 -1
@@ -22,7 +22,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * Please see comments in libcfs/include/libcfs/libcfs_cpu.h for introduction *
net/lnet/libcfs/libcfs_lock.c +0 -1
@@ -21,7 +21,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * Author: [email protected] */
net/lnet/libcfs/libcfs_mem.c +0 -1
@@ -22,7 +22,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * Author: [email protected] */
net/lnet/libcfs/libcfs_string.c +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * String manipulation functions. *
net/lnet/libcfs/module.c +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. */ #include <linux/miscdevice.h> #include <linux/module.h>
net/lnet/libcfs/tracefile.c +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/libcfs/tracefile.c *
net/lnet/libcfs/tracefile.h +0 -1
@@ -28,7 +28,6 @@*/ /* * This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef __LIBCFS_TRACEFILE_H__
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 10/14 lnet: Skip discovery in LNetPrimaryNID if DD disabled
In reply to James SimmonsFrom: Chris Horn <[email protected]>
If discovery is disabled locally then the discovery thread will not modify any peer objects as a result of the discovery process. Thus, the primary NID of any peer we're asked to discover will not change as a result of discovery. Therefore, we do not need to actually perform discovery in LNetPrimaryNID() if discovery is disabled locally. Since this routine can result in long client mount times when a Lustre server is down we should avoid this unnecessary discovery.
HPE-bug-id: LUS-9887
WC-bug-id: https://jira.whamcloud.com/browse/LU-14566
Lustre-commit: 16264da9e3c43a63 ("LU-14566 lnet: Skip discovery in LNetPrimaryNID if DD disabled")
Reviewed-on: https://review.whamcloud.com/43141
--- net/lnet/lnet/peer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/lnet/lnet/peer.c +12 -2
@@ -1336,7 +1336,13 @@ struct lnet_peer_ni * } lp = lpni->lpni_peer_net->lpn_peer; -while (!lnet_peer_is_uptodate (lp)) { +/* If discovery is disabled locally then we needn't bother running +* discovery here because discovery will not modify whatever +* primary NID is currently set for this peer. If the specified peer is +* down then this discovery can introduce long delays into the mount +* process, so skip it if it isn't necessary. +*/ +while (!lnet_peer_discovery_disabled && !lnet_peer_is_uptodate (lp)) {spin_lock (&lp->lp_lock);/* force a full discovery cycle */ lp->lp_state |=LNET_PEER_FORCE_PING |LNET_PEER_FORCE_PUSH ;
@@ -1357,7 +1363,11 @@ struct lnet_peer_ni * } lp = lpni->lpni_peer_net->lpn_peer; -/* Only try once if discovery is disabled */ +/* If we find that the peer has discovery disabled then we will +* not modify whatever primary NID is currently set for this +* peer. Thus, we can break out of this loop even if the peer +* is not fully up to date. +*/ if (lnet_is_discovery_disabled (lp))break ; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 11/14 lustre: ptlrpc: idle import vs lock enqueue race
In reply to James SimmonsFrom: Alexander Boyko <[email protected]>
There is a window after ptlrpc_check_import_is_idle() and setting LUSTRE_IMP_CONNECTING for lock enqueue. The lock get granted on OST and is returned to the client. Server's lock is destroyed on OST_DISCONNECT.
Perform import counters check with setting LUSTRE_IMP_CONNECTING. A regression test_812c was added to sanity.
HPE-bug-id: LUS-8705
WC-bug-id: https://jira.whamcloud.com/browse/LU-14397
Lustre-commit: e6af3c529021976e ("LU-14397 ptlrpc: idle import vs lock enqueue race")
Reviewed-on: https://review.whamcloud.com/41403
--- fs/lustre/include/lustre_net.h | 1 + fs/lustre/include/obd_class.h | 2 ++ fs/lustre/include/obd_support.h | 1 + fs/lustre/obdclass/obd_mount.c | 4 +-- fs/lustre/osc/osc_lock.c | 5 ++++ fs/lustre/ptlrpc/client.c | 11 +++++++ fs/lustre/ptlrpc/import.c | 63 ++++++++++++++++++++++++++++------------- fs/lustre/ptlrpc/pinger.c | 5 ++-- 8 files changed, 69 insertions(+), 23 deletions(-)
fs/lustre/include/lustre_net.h +1 -0
@@ -1904,6 +1904,7 @@ int ptlrpc_request_bufs_pack(struct ptlrpc_request *request, u32 version, int opcode, char **bufs, struct ptlrpc_cli_ctx *ctx);void ptlrpc_req_finished (struct ptlrpc_request *request); +void ptlrpc_req_finished_with_imp_lock (struct ptlrpc_request *request);struct ptlrpc_request *ptlrpc_request_addref (struct ptlrpc_request *req); struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req, unsigned int nfrags,
fs/lustre/include/obd_class.h +2 -0
@@ -1713,6 +1713,8 @@ struct root_squash_info {spinlock_t rsi_lock;/* protects rsi_nosquash_nids */ }; +int server_name2index (const char *svname,u32 *idx,const char **endptr); +/* linux-module.c */ struct obd_ioctl_data ;int obd_ioctl_getdata (struct obd_ioctl_data **data,int *len,void __user *arg);
fs/lustre/include/obd_support.h +1 -0
@@ -365,6 +365,7 @@#define OBD_FAIL_PTLRPC_BULK_REPLY_ATTACH 0x522#define OBD_FAIL_PTLRPC_ROUND_XID 0x530#define OBD_FAIL_PTLRPC_CONNECT_RACE 0x531 +#define OBD_FAIL_PTLRPC_IDLE_RACE 0x533#define OBD_FAIL_OBD_PING_NET 0x600/* OBD_FAIL_OBD_LOG_CANCEL_NET 0x601 obsolete since 1.5 */
fs/lustre/obdclass/obd_mount.c +2 -2
@@ -618,8 +618,7 @@ int server_name2fsname(const char *svname, char *fsname,* rc < 0 on error * if endptr isn't NULL it is set to end of name */ -static int server_name2index (const char *svname,u32 *idx, -const char **endptr) +int server_name2index (const char *svname,u32 *idx,const char **endptr) {unsigned long index;int rc;
@@ -658,6 +657,7 @@ static int server_name2index(const char *svname, u32 *idx,return rc; } +EXPORT_SYMBOL (server_name2index);/*************** mount common between server and client ***************/
fs/lustre/osc/osc_lock.c +5 -0
@@ -1037,6 +1037,11 @@ static int osc_lock_enqueue(const struct lu_env *env,if (osc_lock_is_lockless (oscl)) { oio->oi_lockless =1 ; }else if (!async) { +if (OBD_FAIL_PRECHECK (OBD_FAIL_PTLRPC_IDLE_RACE )) { +OBD_RACE (OBD_FAIL_PTLRPC_IDLE_RACE ); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (HZ /2 ); + }LASSERT (oscl->ols_state ==OLS_GRANTED );LASSERT (oscl->ols_hold);LASSERT (oscl->ols_dlmlock);
fs/lustre/ptlrpc/client.c +11 -0
@@ -2543,6 +2543,17 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)ptlrpc_request_cache_free (request); } +static int __ptlrpc_req_finished (struct ptlrpc_request *request,int locked); +/** +* Drop one request reference. Must be called with import imp_lock held. +* When reference count drops to zero, request is freed. +*/ +void ptlrpc_req_finished_with_imp_lock (struct ptlrpc_request *request) +{ +assert_spin_locked (&request->rq_import->imp_lock); + (void )__ptlrpc_req_finished (request,1 ); +} +/** * Helper function * Drops one reference count for request @request.
fs/lustre/ptlrpc/import.c +44 -19
104 lines not on this page · raw message
fs/lustre/ptlrpc/pinger.c +3 -2
@@ -127,8 +127,9 @@ static int ptlrpc_ping(struct obd_import *imp) {struct ptlrpc_request *req; -if (ptlrpc_check_import_is_idle (imp)) -return ptlrpc_disconnect_and_idle_import (imp); +if (ptlrpc_check_import_is_idle (imp) && +ptlrpc_disconnect_and_idle_import (imp) ==1 ) +return 0 ; req =ptlrpc_prep_ping (imp);if (!req) {
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 12/14 lustre: mdc: make rpc set for MDS_STATFS interruptible
In reply to James SimmonsFrom: Alex Zhuravlev <[email protected]>
otherwise it ignores signals making imposible to interrupt mount process with a signal which is checked by conf-sanity/23a
WC-bug-id: https://jira.whamcloud.com/browse/LU-14344
Lustre-commit: f125ba1f42b9b046 ("LU-14344 mdc: make rpc set for MDS_STATFS interruptible")
Reviewed-on: https://review.whamcloud.com/41282
--- fs/lustre/mdc/mdc_request.c | 1 + 1 file changed, 1 insertion(+)
fs/lustre/mdc/mdc_request.c +1 -0
@@ -1611,6 +1611,7 @@ static int mdc_statfs(const struct lu_env *env, rc = -ENOMEM ; goto output; } + req->rq_allow_intr =1 ;if ((flags &OBD_STATFS_SUM ) && (exp_connect_flags2 (exp) &OBD_CONNECT2_SUM_STATFS )) {
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 13/14 lustre: llite: fake symlink type of foreign file/dir
In reply to James SimmonsFrom: Bruno Faccini <[email protected]>
This patch implements a "fake symlink" specific usage of "foreign" LOV/LMV format. It basically allows these particular type of foreign files/dirs to behave as a symlink from VFS point of view, by allowing to construct a relative path from the LOV/LMV foreign content, to complement it with a prefix, and then to expose it to the VFS as a symlink destination. The default/internal mechanism simply takes the full foreign free string as the relative path, and for more complex internal formats an upcall has been implemented to provide format's details (presently just in terms of constant strings and substrings positions in EA, but this can be enhanced) to llite layer.
Using this feature, instead of real symlinks or user EA, will permit to benefit from the special features (lock, prefetch, caches) already implemented to handle both LOV/LMV EAs.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12682
Lustre-commit: 15d44e787e17ff5 ("LU-12682 llite: fake symlink type of foreign file/dir")
Reviewed-on: https://review.whamcloud.com/35856
--- fs/lustre/llite/Makefile | 1 + fs/lustre/llite/dcache.c | 14 +- fs/lustre/llite/dir.c | 11 + fs/lustre/llite/file.c | 50 ++- fs/lustre/llite/foreign_symlink.h | 49 +++ fs/lustre/llite/llite_foreign.c | 284 ++++++++++++ fs/lustre/llite/llite_foreign_symlink.c | 758 ++++++++++++++++++++++++++++++++ fs/lustre/llite/llite_internal.h | 35 +- fs/lustre/llite/llite_lib.c | 105 +++++ fs/lustre/llite/lproc_llite.c | 12 + fs/lustre/llite/namei.c | 33 +- fs/lustre/llite/pcc.c | 4 +- fs/lustre/llite/symlink.c | 1 + fs/lustre/lov/lov_object.c | 3 +- fs/lustre/lov/lov_pack.c | 13 +- include/uapi/linux/lustre/lustre_user.h | 49 ++- 16 files changed, 1399 insertions(+), 23 deletions(-) create mode 100644 fs/lustre/llite/foreign_symlink.h create mode 100644 fs/lustre/llite/llite_foreign.c create mode 100644 fs/lustre/llite/llite_foreign_symlink.c
fs/lustre/llite/Makefile +1 -0
@@ -7,6 +7,7 @@ lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \ xattr.o xattr_cache.o xattr_security.o \ super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \ vvp_dev.o vvp_page.o vvp_io.o vvp_object.o \ + llite_foreign.o llite_foreign_symlink.o \ lproc_llite.o pcc.o lustre-$(CONFIG_LUSTRE_FS_POSIX_ACL) += acl.o
fs/lustre/llite/dcache.c +12 -2
@@ -248,8 +248,18 @@ static int ll_revalidate_dentry(struct dentry *dentry,return 1 ;/* Symlink - always valid as long as the dentry was found */ -if (dentry->d_inode &&S_ISLNK (dentry->d_inode->i_mode)) -return 1 ; +/* only special case is to prevent ELOOP error from VFS during open +* of a foreign symlink file/dir with O_NOFOLLOW, like it happens for +* real symlinks. This will allow to open foreign symlink file/dir +* for get[dir]stripe/unlock ioctl()s. +*/ +if (dentry->d_inode && dentry->d_inode->i_op->get_link) { +if (!S_ISLNK (dentry->d_inode->i_mode) && + !(lookup_flags &LOOKUP_FOLLOW )) +return 0 ; +else +return 1 ; + }/* * VFS warns us that this is the second go around and previous
fs/lustre/llite/dir.c +11 -0
@@ -1641,6 +1641,17 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)ptlrpc_req_finished (root_request);return rc; } + +case LL_IOC_UNLOCK_FOREIGN : +/* if not a foreign symlink do nothing */ +if (ll_foreign_is_removable (dentry, true)) { +CDEBUG (D_INFO , +"prevent rmdir of non-foreign dir (" DFID ")\n" , +PFID (ll_inode2fid (inode))); +return -EOPNOTSUPP ; + } +return 0 ; +case LL_IOC_RMFID :return ll_rmfid (file, (void __user *)arg);case LL_IOC_LOV_SWAP_LAYOUTS :
fs/lustre/llite/file.c +40 -10
109 lines not on this page · raw message
fs/lustre/llite/foreign_symlink.h new file +49 -0
49 lines not on this page · raw message
fs/lustre/llite/llite_foreign.c new file +284 -0
284 lines not on this page · raw message
fs/lustre/llite/llite_foreign_symlink.c new file +758 -0
758 lines not on this page · raw message
fs/lustre/llite/llite_internal.h +34 -1
@@ -51,6 +51,7 @@#include "vvp_internal.h" #include "pcc.h" +#include "foreign_symlink.h" /** Only used on client-side for indicating the tail of dir hash/offset. */ #define LL_DIR_END_OFF 0x7fffffffffffffffULL
@@ -102,6 +103,8 @@ enum ll_file_flags {* local inode atime. */ LLIF_UPDATE_ATIME =4 , +/* foreign file/dir can be unlinked unconditionnaly */ +LLIF_FOREIGN_REMOVABLE =5 ,/* setting encryption context in progress */ LLIF_SET_ENC_CTX = 6, };
@@ -619,6 +622,10 @@ enum stats_track_type {#define LL_SBI_FILE_HEAT 0x4000000/* file heat support */ #define LL_SBI_TEST_DUMMY_ENCRYPTION 0x8000000/* test dummy encryption */ #define LL_SBI_ENCRYPT 0x10000000/* client side encryption */ +#define LL_SBI_FOREIGN_SYMLINK 0x20000000/* foreign fake-symlink support */ +/* foreign fake-symlink upcall registered */ +#define LL_SBI_FOREIGN_SYMLINK_UPCALL 0x40000000 +#define LL_SBI_FLAGS { \ "nolck", \ "checksum", \
@@ -649,6 +656,8 @@ enum stats_track_type {"file_heat" , \"test_dummy_encryption" , \"noencrypt" , \ +"foreign_symlink" , \ + "foreign_symlink_upcall", \ }/*
@@ -761,6 +770,19 @@ struct ll_sb_info {/* Persistent Client Cache */ struct pcc_super ll_pcc_super; + +/* to protect vs updates in all following foreign symlink fields */ +struct rw_semaphore ll_foreign_symlink_sem; +/* foreign symlink path prefix */ +char *ll_foreign_symlink_prefix; +/* full prefix size including leading '\0' */ +size_t ll_foreign_symlink_prefix_size; +/* foreign symlink path upcall */ +char *ll_foreign_symlink_upcall; +/* foreign symlink path upcall infos */ +struct ll_foreign_symlink_upcall_item *ll_foreign_symlink_upcall_items; +/* foreign symlink path upcall nb infos */ +unsigned int ll_foreign_symlink_upcall_nb_items; };#define SBI_DEFAULT_HEAT_DECAY_WEIGHT ((80 * 256 + 50) / 100)
@@ -951,6 +973,11 @@ static inline bool ll_sbi_has_file_heat(struct ll_sb_info *sbi)return !!(sbi->ll_flags &LL_SBI_FILE_HEAT ); } +static inline bool ll_sbi_has_foreign_symlink (struct ll_sb_info *sbi) +{ +return !!(sbi->ll_flags &LL_SBI_FOREIGN_SYMLINK ); +} +void ll_ras_enter (struct file *f,loff_t pos,size_t count);/* llite/lcommon_misc.c */
@@ -1063,6 +1090,8 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, u64 bits,int ll_md_real_close (struct inode *inode,fmode_t fmode);int ll_getattr (const struct path *path,struct kstat *stat,u32 request_mask,unsigned int flags); +int ll_getattr_dentry (struct dentry *de,struct kstat *stat,u32 request_mask, +unsigned int flags,bool foreign);#ifdef CONFIG_LUSTRE_FS_POSIX_ACL struct posix_acl *ll_get_acl (struct inode *inode,int type);int ll_set_acl (struct inode *inode,struct posix_acl *acl,int type);
@@ -1459,7 +1488,7 @@ static inline int cl_agl(struct inode *inode)int ll_file_lock_ahead (struct file *file,struct llapi_lu_ladvise *ladvise);int cl_io_get (struct inode *inode,struct lu_env **envout, -struct cl_io **ioout,__u16 *refcheck); +struct cl_io **ioout,u16 *refcheck);static inline int ll_glimpse_size (struct inode *inode) {
@@ -1671,5 +1700,9 @@ inline void ll_sbi_set_encrypt(struct ll_sb_info *sbi, bool set) { }#endif /* !CONFIG_FS_ENCRYPTION */ +/* llite/llite_foreign.c */ +int ll_manage_foreign (struct inode *inode,struct lustre_md *lmd); +bool ll_foreign_is_openable (struct dentry *dentry,unsigned int flags); +bool ll_foreign_is_removable (struct dentry *dentry,bool unset);#endif /* LLITE_INTERNAL_H */
fs/lustre/llite/llite_lib.c +105 -0
141 lines not on this page · raw message
fs/lustre/llite/lproc_llite.c +12 -0
@@ -290,6 +290,14 @@ static ssize_t client_type_show(struct kobject *kobj, struct attribute *attr, }LUSTRE_RO_ATTR (client_type); +LUSTRE_RW_ATTR (foreign_symlink_enable); + +LUSTRE_RW_ATTR (foreign_symlink_prefix); + +LUSTRE_RW_ATTR (foreign_symlink_upcall); + +LUSTRE_WO_ATTR (foreign_symlink_upcall_info); +static ssize_t fstype_show (struct kobject *kobj,struct attribute *attr,char *buf) {
@@ -1551,6 +1559,10 @@ struct ldebugfs_vars lprocfs_llite_obd_vars[] = { &lustre_attr_filestotal.attr, &lustre_attr_filesfree.attr, &lustre_attr_client_type.attr, + &lustre_attr_foreign_symlink_enable.attr, + &lustre_attr_foreign_symlink_prefix.attr, + &lustre_attr_foreign_symlink_upcall.attr, + &lustre_attr_foreign_symlink_upcall_info.attr, &lustre_attr_fstype.attr, &lustre_attr_uuid.attr, &lustre_attr_max_read_ahead_mb.attr,
fs/lustre/llite/namei.c +29 -4
@@ -48,7 +48,7 @@static int ll_create_it (struct inode *dir,struct dentry *dentry,struct lookup_intent *it,void *secctx,u32 secctxlen,bool encrypt, -void *encctx,__u32 encctxlen); +void *encctx,u32 encctxlen);/* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ static int ll_test_inode (struct inode *inode,void *opaque)
@@ -597,6 +597,23 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) }else {struct dentry *new =d_splice_alias (inode, de); +/* this needs only to be done for foreign symlink dirs as +* DCACHE_SYMLINK_TYPE is already set by d_flags_for_inode() +* kernel routine for files with symlink ops (ie, real symlink) +*/ +if (inode &&ll_sbi_has_foreign_symlink (ll_i2sbi (inode)) && + inode->i_op->get_link) { +CDEBUG (D_INFO , +"%s: inode " DFID ": faking foreign dir as a symlink\n" , +ll_i2sbi (inode)->ll_fsname, +PFID (ll_inode2fid (inode))); +spin_lock (&de->d_lock); +/* like d_flags_for_inode() already does for files */ + de->d_flags = (de->d_flags & ~DCACHE_ENTRY_TYPE ) | +DCACHE_SYMLINK_TYPE ; +spin_unlock (&de->d_lock); + } +if (IS_ERR (new)) CDEBUG(D_DENTRY, "splice inode %p as %pd gives error %lu\n",
@@ -1187,8 +1204,8 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, } } -if (d_really_is_positive (dentry) && -it_disposition (it,DISP_OPEN_OPEN )) { +if (dentry->d_inode &&it_disposition (it,DISP_OPEN_OPEN ) && +ll_foreign_is_openable (dentry, open_flags)) {/* Open dentry. */ if (S_ISFIFO (d_inode (dentry)->i_mode)) {/* We cannot call open here as it might
@@ -1270,7 +1287,7 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)static int ll_create_it (struct inode *dir,struct dentry *dentry,struct lookup_intent *it,void *secctx,u32 secctxlen,bool encrypt, -void *encctx,__u32 encctxlen) +void *encctx,u32 encctxlen) {struct inode *inode;u64 bits =0 ;
@@ -1581,6 +1598,10 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild)CDEBUG (D_VFSTRACE ,"VFS Op:name=%pd,dir=%lu/%u(%p)\n" , dchild, dir->i_ino, dir->i_generation, dir); +/* some foreign file/dir may not be allowed to be unlinked */ +if (!ll_foreign_is_removable (dchild, false)) +return -EPERM ; + op_data = ll_prep_md_op_data(NULL, dir, NULL, dchild->d_name.name, dchild->d_name.len,
@@ -1647,6 +1668,10 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild)CDEBUG (D_VFSTRACE ,"VFS Op:name=%pd, dir=" DFID "(%p)\n" , dchild,PFID (ll_inode2fid (dir)), dir); +/* some foreign dir may not be allowed to be removed */ +if (!ll_foreign_is_removable (dchild, false)) +return -EPERM ; + op_data = ll_prep_md_op_data(NULL, dir, NULL, dchild->d_name.name, dchild->d_name.len,
fs/lustre/llite/pcc.c +2 -2
@@ -1152,12 +1152,12 @@ static int pcc_get_layout_info(struct inode *inode, struct cl_layout *clt)return PTR_ERR (env); rc =cl_object_layout_get (env, lli->lli_clob, clt); -if (rc) +if (rc <0 )CDEBUG (D_INODE ,"Cannot get layout for " DFID "\n" ,PFID (ll_inode2fid (inode)));cl_env_put (env, &refcheck); -return rc; +return rc <0 ? rc :0 ; } static int pcc_fid2dataset_fullpath(char *buf, int sz, struct lu_fid *fid,
fs/lustre/llite/symlink.c +1 -0
@@ -37,6 +37,7 @@#include "llite_internal.h" +/* Must be called with lli_size_mutex locked */ static int ll_readlink_internal (struct inode *inode,struct ptlrpc_request **request,char **symname) {
fs/lustre/lov/lov_object.c +2 -1
@@ -2177,7 +2177,8 @@ static int lov_object_layout_get(const struct lu_env *env, rc =lov_lsm_pack (lsm, buf->lb_buf, buf->lb_len);lov_lsm_put (lsm); -return rc <0 ? rc :0 ; +/* return error or number of bytes */ +return rc; }static loff_t lov_object_maxbytes (struct cl_object *obj)
fs/lustre/lov/lov_pack.c +11 -2
@@ -163,8 +163,14 @@ static ssize_t lov_lsm_pack_foreign(const struct lov_stripe_md *lsm, void *buf,if (buf_size ==0 )return lfm_size; -if (buf_size < lfm_size) +/* if buffer too small return ERANGE but copy the size the +* caller has requested anyway. This may be useful to get +* only the header without the need to alloc the full size +*/ +if (buf_size < lfm_size) { +memcpy (lfm,lsm_foreign (lsm), buf_size);return -ERANGE ; + }/* full foreign LOV is already avail in its cache * no need to translate format fields to little-endian
@@ -189,8 +195,10 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf,if (lsm->lsm_magic ==LOV_MAGIC_V1 || lsm->lsm_magic ==LOV_MAGIC_V3 )return lov_lsm_pack_v1v3 (lsm, buf, buf_size); -if (lsm->lsm_magic ==LOV_MAGIC_FOREIGN ) +if (lsm->lsm_magic ==LOV_MAGIC_FOREIGN ) { +pr_info ("calling lov_lsm_pack_foreign\n" );return lov_lsm_pack_foreign (lsm, buf, buf_size); + } lmm_size =lov_comp_md_size (lsm);if (buf_size ==0 )
@@ -370,6 +378,7 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj, lmm_size =lov_lsm_pack (lsm, lmmk, lmmk_size);if (lmm_size <0 ) { +pr_info ("lov_lsm_pack return rc = %zd\n" , lmm_size); rc = lmm_size; goto out_free; }
include/uapi/linux/lustre/lustre_user.h +48 -1
67 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 14/14 lustre: llite: use d_is_symlink to test if dentry is a symlink
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
Using d_is_symlink() is preferred to testing ->get_link or ->follow_link.
A recent patch made this work for foreign files/dirs by making sure the entry type in d_flags is correct, so we can simplify the code in ll_revalidate_dentry().
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: 36b1e4c4142f8a72 ("LU-6142 llite: use d_is_symlink to test if dentry is a symlink")
Reviewed-on: https://review.whamcloud.com/41770
--- fs/lustre/llite/dcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lustre/llite/dcache.c +1 -1
@@ -253,7 +253,7 @@ static int ll_revalidate_dentry(struct dentry *dentry,* real symlinks. This will allow to open foreign symlink file/dir * for get[dir]stripe/unlock ioctl()s. */ -if (dentry->d_inode && dentry->d_inode->i_op->get_link) { +if (d_is_symlink (dentry)) {if (!S_ISLNK (dentry->d_inode->i_mode) && !(lookup_flags &LOOKUP_FOLLOW ))return 0 ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org