From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753173AbdAHPbi (ORCPT ); Sun, 8 Jan 2017 10:31:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42351 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752717AbdAHPbc (ORCPT ); Sun, 8 Jan 2017 10:31:32 -0500 Subject: Re: xfs: commit 6552321831dc "xfs: remove i_iolock and use i_rwsem in the VFS inode instead" change causes hang From: Mimi Zohar To: Christoph Hellwig Cc: linux-xfs@vger.kernel.org, Dave Chinner , linux-fsdevel , linux-kernel , Al Viro Date: Sun, 08 Jan 2017 10:31:22 -0500 In-Reply-To: <20170108151430.GA29847@lst.de> References: <1483886924.8189.81.camel@linux.vnet.ibm.com> <20170108145200.GA29570@lst.de> <1483887789.8189.90.camel@linux.vnet.ibm.com> <20170108151430.GA29847@lst.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17010815-0052-0000-0000-000002073A92 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17010815-0053-0000-0000-0000078FE4D1 Message-Id: <1483889482.8189.104.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-08_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701080236 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2017-01-08 at 16:14 +0100, Christoph Hellwig wrote: > On Sun, Jan 08, 2017 at 10:03:09AM -0500, Mimi Zohar wrote: > > But not normally for a normal file read. > > Depends on the file system. In addition to XFS at least the NFS > also uses i_rwsem by default. Also all file systems supporting > a DAX I/O path. We're only interested in the integrity of the local file system. > > Unless something has changed recently, to synchronize reading files to > > calculate the file hash and writing xattrs it has to take the i_rwsem > > prior to reading the file. > > No, you must simply not do this at all. If you take a lock that > belongs to the fs and is not your own over ->read_iter you're toast > as you've seen. Christoph, this isn't a new story and telling me this isn't very productive. Originally there was an IMA specific lock. The i_mutex was taken just to access the xattr. Unforutnately, having two locks caused a lockdep between the normal read/validate and setxattr. As a result, we dropped the IMA specific lock. IMA needs a mechanism for quickly reading a file to calculate the file hash and validate (or set) the file signature/hash stored as an xattr, prior to any other process getting access to the file. Mimi