From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756331AbdAHPD0 (ORCPT ); Sun, 8 Jan 2017 10:03:26 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51316 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751811AbdAHPDS (ORCPT ); Sun, 8 Jan 2017 10:03:18 -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:03:09 -0500 In-Reply-To: <20170108145200.GA29570@lst.de> References: <1483886924.8189.81.camel@linux.vnet.ibm.com> <20170108145200.GA29570@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-0004-0000-0000-000001D13C8A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17010815-0005-0000-0000-00000972DE38 Message-Id: <1483887789.8189.90.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-1701080228 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2017-01-08 at 15:52 +0100, Christoph Hellwig wrote: > On Sun, Jan 08, 2017 at 09:48:44AM -0500, Mimi Zohar wrote: > > IMA takes the i_rwsem (fomerly i_mutex) before reading the file to > > synchronize calculating the file hash and validating the file's > > hash/signature stored as security.ima xattr > > Well, it shouldn't do that. In the I/O path i_rwsem is up to the > fs to use. Various other file systems also take it internally for > reads, although mostly only for direct I/O. But not normally for a normal file read. For direct I/O, IMA fails the file hash/signature verification, measurement, audit unless the IMA "permit_directio" rule is defined. > So the answer here is that ima needs to stop playing with i_rwsem. 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. Mimi