From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de ([213.95.11.211]:40678 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753996AbeDZHRR (ORCPT ); Thu, 26 Apr 2018 03:17:17 -0400 Date: Thu, 26 Apr 2018 09:19:00 +0200 From: Christoph Hellwig To: "J. R. Okajima" Cc: Christoph Hellwig , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] fs: fold open_check_o_direct into do_dentry_open Message-ID: <20180426071900.GA14524@lst.de> References: <20180320103014.23242-1-hch@lst.de> <6741.1524668614@jrobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6741.1524668614@jrobl> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Apr 26, 2018 at 12:03:34AM +0900, J. R. Okajima wrote: > Christoph Hellwig: > > do_dentry_open is where we do the actual open of the file, so this is > > where we should do our O_DIRECT sanity check to cover all potential > > callers. > ::: > > diff --git a/fs/namei.c b/fs/namei.c > > index 920a828ab2ce..9d6d8e8aed55 100644 > > --- a/fs/namei.c > > +++ b/fs/namei.c > > @@ -3374,9 +3374,7 @@ static int do_last(struct nameidata *nd, > > goto out; > > *opened |= FILE_OPENED; > > opened: > > - error = open_check_o_direct(file); > > - if (!error) > > - error = ima_file_check(file, op->acc_mode, *opened); > > + error = ima_file_check(file, op->acc_mode, *opened); > > if (!error && will_truncate) > > error = handle_truncate(file); > > Removing the check from here may cause a problem I am afraid. > In open(O_ATOMIC|O_DIRECT) case, the check is totally gone, isn't it? You mean O_DIRECT using ->atomic_open? Those are supposed to call finish_open(), which calls do_dentry_open and thus the O_DIRECT check. > > > > J. R. Okajima ---end quoted text---