Whamcloud - gitweb
b=20989 lov_merge_lvb()) ASSERTION(spin_is_locked(&lsm->lsm_lock)) failed
authorDmitry Zogin <dmitry.zogin@sun.com>
Mon, 1 Mar 2010 13:39:47 +0000 (08:39 -0500)
committerJohann Lombardi <johann@sun.com>
Mon, 1 Mar 2010 22:37:30 +0000 (23:37 +0100)
 Protect lli->lli_smd pointer updates with lli->lli_lock.

 o=oleg.drokin
 i=johann
 i=dmitry.zogin

lustre/llite/llite_internal.h
lustre/llite/llite_lib.c

index 196773a..6c79825 100644 (file)
@@ -138,7 +138,8 @@ struct ll_inode_info {
         unsigned long           lli_flags;
         cfs_time_t              lli_contention_time;
 
-        /* this lock protects s_d_w and p_w_ll and mmap_cnt */
+        /* this lock protects s_d_w and p_w_ll and mmap_cnt;
+         * atomic check-update of lli_smd */
         spinlock_t              lli_lock;
 #ifdef HAVE_CLOSE_THREAD
         struct list_head        lli_pending_write_llaps;
index a9362c8..c078249 100644 (file)
@@ -1829,6 +1829,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
 
         LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0));
         if (lsm != NULL) {
+                spin_lock(&lli->lli_lock);
                 if (lli->lli_smd == NULL) {
                         if (lsm->lsm_magic != LOV_MAGIC_V1 &&
                             lsm->lsm_magic != LOV_MAGIC_V3 &&
@@ -1842,10 +1843,12 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
                          * with lli_smd != NULL or lock_lsm == 0 or we can
                          * race between lock/unlock.  bug 9547 */
                         lli->lli_smd = lsm;
+                        spin_unlock(&lli->lli_lock);
                         lli->lli_maxbytes = lsm->lsm_maxbytes;
                         if (lli->lli_maxbytes > PAGE_CACHE_MAXBYTES)
                                 lli->lli_maxbytes = PAGE_CACHE_MAXBYTES;
                 } else {
+                        spin_unlock(&lli->lli_lock);
                         if ((lli->lli_smd->lsm_magic == lsm->lsm_magic ||
                              (lli->lli_smd->lsm_magic == LOV_MAGIC_V3 &&
                               lsm->lsm_magic == LOV_MAGIC_V1) ||