From b8e712cc676975a355f79138dfaaec98dbbad9a2 Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 15 Mar 2005 19:13:38 +0000 Subject: [PATCH] Branch: b1_4 Fix lock deadlock between obdfilter statistics gathering and object creation (they used the same lock and stats handling might be in an IRQ). b=5811 r=adilger (original patch from phil) --- lustre/ChangeLog | 31 ++++++++++++++++--------------- lustre/include/linux/obd.h | 5 +++-- lustre/obdfilter/filter.c | 3 ++- lustre/obdfilter/filter_io_26.c | 8 ++++---- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 928bf19..c3dcfd0 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,25 +1,26 @@ tbd Cluster File Systems, Inc. * version 1.4.1 * bug fixes - - don't LASSERT in ll_release on NULL lld with NFS export (4655, 5760) - - hold NS lock when calling handle_ast_error->del_waiting_lock (5746) - - fix setattr mtime regression from lovcleanup merge (4829, 5669) - - workaround for 2.6 crash in ll_unhash_aliases (5687, 5210) - - small ext3 extents cleanups and fixes (5733) - - improved mballoc code, several small races and bugs fixed (5733, 5638) - - kernel version 43: fix remove_suid bugs in both 2.4 and 2.6 (5695) - - avoid needless client->OST connect, fix handle mismatch (5317) - - fix DLM error path that led to out-of-sync client, long delays (5779) - - support common vfs-enforced mount options (nodev,nosuid,noexec) (5637) - - fix several locking issues related to i_size (5492,5624,5654,5672) + - don't LASSERT in ll_release on NULL lld with NFS export (4655, 5760) + - hold NS lock when calling handle_ast_error->del_waiting_lock (5746) + - fix setattr mtime regression from lovcleanup merge (4829, 5669) + - workaround for 2.6 crash in ll_unhash_aliases (5687, 5210) + - small ext3 extents cleanups and fixes (5733) + - improved mballoc code, several small races and bugs fixed (5733, 5638) + - kernel version 43 - fix remove_suid bugs in both 2.4 and 2.6 (5695) + - avoid needless client->OST connect, fix handle mismatch (5317) + - fix DLM error path that led to out-of-sync client, long delays (5779) + - support common vfs-enforced mount options (nodev,nosuid,noexec) (5637) + - fix several locking issues related to i_size (5492,5624,5654,5672) - don't move pending lock onto export if it is already evicted (5683) - fix kernel oops when creating .foo in unlinked directory (5548) + - fix deadlock in obdfilter statistics vs. object create (5811) * miscellania - - fix lustre/lustrefs init scripts for SuSE (patch from Scali, 5702) - - don't hold the pinger_sem in ptlrpc_pinger_sending_on_import - - change obd_increase_kms to obd_adjust_kms (up or down) (5654) + - fix lustre/lustrefs init scripts for SuSE (patch from Scali, 5702) + - don't hold the pinger_sem in ptlrpc_pinger_sending_on_import + - change obd_increase_kms to obd_adjust_kms (up or down) (5654) - lconf, lmc search both /usr/lib and /usr/lib64 for Python libs (5800) - - by default create 1 inode per 4kB space on MDS, per 16kB on OSTs + - by default create 1 inode per 4kB space on MDS, per 16kB on OSTs 2005-02-18 Cluster File Systems, Inc. * version 1.4.0.10 (1.4.1 release candidate 1) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index a9704f5..9f24687 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -206,8 +206,9 @@ struct filter_obd { struct semaphore fo_alloc_lock; - int fo_r_in_flight; /* protected by fo_objidlock */ - int fo_w_in_flight; /* protected by fo_objidlock */ + spinlock_t fo_stats_lock; + int fo_r_in_flight; /* protected by fo_stats_lock */ + int fo_w_in_flight; /* protected by fo_stats_lock */ struct obd_histogram fo_r_pages; struct obd_histogram fo_w_pages; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index acbb5f2..ddede28 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1240,6 +1240,7 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, spin_lock_init(&filter->fo_translock); spin_lock_init(&filter->fo_objidlock); + spin_lock_init(&filter->fo_stats_lock); INIT_LIST_HEAD(&filter->fo_export_list); sema_init(&filter->fo_alloc_lock, 1); spin_lock_init(&filter->fo_r_pages.oh_lock); @@ -2257,7 +2258,7 @@ static int filter_truncate(struct obd_export *exp, struct obdo *oa, CERROR("PUNCH not supported, only truncate: end = "LPX64"\n", end); - CDEBUG(D_INODE, "calling truncate for object "LPU64", valid = %x, " + CDEBUG(D_INODE, "calling truncate for object "LPU64", valid = %x, ", "o_size = "LPD64"\n", oa->o_id, oa->o_valid, start); oa->o_size = start; error = filter_setattr(exp, oa, NULL, oti); diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index 64edfaf..722e23d 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -70,12 +70,12 @@ static void record_start_io(struct dio_request *dreq, int rw, int size) filter->fo_w_in_flight); lprocfs_oh_tally_log2(&filter->fo_w_disk_iosize, size); } - spin_lock_irqsave(&filter->fo_objidlock, flags); + spin_lock_irqsave(&filter->fo_stats_lock, flags); if (rw == OBD_BRW_READ) filter->fo_r_in_flight++; else filter->fo_w_in_flight++; - spin_unlock_irqrestore(&filter->fo_objidlock, flags); + spin_unlock_irqrestore(&filter->fo_stats_lock, flags); dreq->dr_start_time = jiffies; } @@ -84,12 +84,12 @@ static void record_finish_io(struct dio_request *dreq, int rw, int rc) struct filter_obd *filter = dreq->dr_filter; unsigned long flags, stop_time = jiffies; - spin_lock_irqsave(&filter->fo_objidlock, flags); + spin_lock_irqsave(&filter->fo_stats_lock, flags); if (rw == OBD_BRW_READ) filter->fo_r_in_flight--; else filter->fo_w_in_flight--; - spin_unlock_irqrestore(&filter->fo_objidlock, flags); + spin_unlock_irqrestore(&filter->fo_stats_lock, flags); if (atomic_dec_and_test(&dreq->dr_numreqs)) wake_up(&dreq->dr_wait); -- 1.8.3.1