Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp345452ybh; Thu, 12 Mar 2020 03:08:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuhTE1XrNWy5JccCD5S512pR8pl3no64hUlZ8/adwuVh7xuV8Pm+y3aKR019WsXczj9tJC3 X-Received: by 2002:a9d:554c:: with SMTP id h12mr5913417oti.16.1584007735189; Thu, 12 Mar 2020 03:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584007735; cv=none; d=google.com; s=arc-20160816; b=cuZaLmvqWadao30dJO4Y+O5kuqtS+eU6eRyTWIcTqSaaZ4MuJ+PhYmJoD+J5nN5/8l pGatZ6Z31troyyoFd2j86RmhUdpTLPiMAlu4y5Xjn6JG69AvTHToUsa3GJsiwGNf8c0y VZa6cc1RLwh4cE4NgfC/Op3bOCe1SgMOA8cjdaLaTZU+frQUk5Bif70IYdeSOSJqL7Qt v+mCtgDga3b9TSTepH9a09OYwi5H5lr4azZ4m4x+T259vXqcLCtA49rXo1gqKcfhEhHN /0bmDxPRocexjfkkfTmzJyu9LJBG9GVuafeqqHsxvgJogl/+QDW/s6YluER+NhYf88z5 bz0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=UREMN3SChoR23ul+gfDOcGQfVoGjOsof5Gn863j6Nd4=; b=sjsS+eXF6sD+dqiSz9NUbyx9oDJ+nhjZ0BTK3IYVQzc4FhgvMa2Q6f+wLsO/L6D2BA Ad/Xo8s4ED48xWQBy3BNNCTJMyr+5P8ngVmtDtpEwRpQnIEk3rFkFrHgUllK50Amzj8Q vBIQZwVqFFuDXBNgFvY37Xlxn+75kFoiEM1UoG12PLGNqFNd/fWr6YhkLvRW1Tn6AdR3 tOcaswK4+0FJC0DapFOoX879sLLlWBpBUWuJzEGXoG7z/mLzunBIuDbgStikbLilL6SF nsC6vQ+QrCZPLEys0Wqc8TAVM6QeJ1TRSHNMhXtvUWEW4iwYe7oWc5uYzdt50sx1gStG Oyjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MzglNq44; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l126si2419659oih.31.2020.03.12.03.08.38; Thu, 12 Mar 2020 03:08:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MzglNq44; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726044AbgCLKIE (ORCPT + 99 others); Thu, 12 Mar 2020 06:08:04 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:40586 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726385AbgCLKIE (ORCPT ); Thu, 12 Mar 2020 06:08:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584007683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UREMN3SChoR23ul+gfDOcGQfVoGjOsof5Gn863j6Nd4=; b=MzglNq44XB+zf0N2ytutSrPUdnmFugYfapsjgHVrpIEzAgUZxOJjwLDMUCEbVkwqanL09Y RIZzan8dPHqwMFrHScgLDBqzdtIAcVnzItvqkxjI7vhM0Q37Qrl3XCpeWI7tj9R3bS4FCY cHGQmCJqDq+//hGEDsGZZvsPYGC4Jdo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-242-HwXjt_E_PU-qSYhRePSKpw-1; Thu, 12 Mar 2020 06:08:01 -0400 X-MC-Unique: HwXjt_E_PU-qSYhRePSKpw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DBA34189D6D3; Thu, 12 Mar 2020 10:07:59 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-182.rdu2.redhat.com [10.10.120.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id E57D3277AD; Thu, 12 Mar 2020 10:07:57 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <969260.1584004779@warthog.procyon.org.uk> References: <969260.1584004779@warthog.procyon.org.uk> To: mbobrowski@mbobrowski.org, darrick.wong@oracle.com Cc: dhowells@redhat.com, jack@suse.cz, hch@lst.de, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: Is ext4_dio_read_iter() broken? - and xfs_file_dio_aio_read() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1015226.1584007677.1@warthog.procyon.org.uk> Date: Thu, 12 Mar 2020 10:07:57 +0000 Message-ID: <1015227.1584007677@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org David Howells wrote: > Is ext4_dio_read_iter() broken? It calls: > > file_accessed(iocb->ki_filp); > > at the end of the function - but surely iocb should be expected to have been > freed when iocb->ki_complete() was called? I think it's actually worse than that. You also can't call inode_unlock_shared(inode) because you no longer own a ref on the inode since ->ki_complete() is expected to call fput() on iocb->ki_filp. Yes, you own a shared lock on it, but unless somewhere along the fput-dput-iput chain the inode lock is taken exclusively, the inode can be freed whilst you're still holding the lock. Oh - and ext4_dax_read_iter() is also similarly broken. And xfs_file_dio_aio_read() appears to be broken as it touches the inode after calling iomap_dio_rw() to unlock it. David