Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae5ef67b authored by Sebastien Buisson's avatar Sebastien Buisson Committed by Greg Kroah-Hartman
Browse files

staging/lustre/llite: fix 'data race condition' issues of lli_flags

Fix 'data race condition' defects found by Coverity version
6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

lli->lli_flags need to be protected by lli->lli_lock.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Lustre-change: http://review.whamcloud.com/6571


Signed-off-by: default avatarSebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarKeith Mannthey <keith.mannthey@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f84d3d47
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1189,7 +1189,9 @@ void ll_clear_inode(struct inode *inode)
		LASSERT(lli->lli_opendir_pid == 0);
	}

	spin_lock(&lli->lli_lock);
	ll_i2info(inode)->lli_flags &= ~LLIF_MDS_SIZE_LOCK;
	spin_unlock(&lli->lli_lock);
	md_null_inode(sbi->ll_md_exp, ll_inode2fid(inode));

	LASSERT(!lli->lli_open_fd_write_count);
@@ -1756,7 +1758,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
					/* Use old size assignment to avoid
					 * deadlock bz14138 & bz14326 */
					i_size_write(inode, body->size);
					spin_lock(&lli->lli_lock);
					lli->lli_flags |= LLIF_MDS_SIZE_LOCK;
					spin_unlock(&lli->lli_lock);
				}
				ldlm_lock_decref(&lockh, mode);
			}
+4 −1
Original line number Diff line number Diff line
@@ -275,8 +275,11 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
				CDEBUG(D_INODE, "invaliding layout %d.\n", rc);
		}

		if (bits & MDS_INODELOCK_UPDATE)
		if (bits & MDS_INODELOCK_UPDATE) {
			spin_lock(&lli->lli_lock);
			lli->lli_flags &= ~LLIF_MDS_SIZE_LOCK;
			spin_unlock(&lli->lli_lock);
		}

		if (S_ISDIR(inode->i_mode) &&
		     (bits & MDS_INODELOCK_UPDATE)) {