Received: by 10.192.165.156 with SMTP id m28csp725090imm; Fri, 13 Apr 2018 06:51:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ucrH2E7j/FT0qsS1/ZF36dLP++KWcErHBjU1XA+PQYJdEf+O2Bsj2SJLwLvNNsjD5fSqF X-Received: by 2002:a17:902:9898:: with SMTP id s24-v6mr5275524plp.51.1523627463246; Fri, 13 Apr 2018 06:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523627463; cv=none; d=google.com; s=arc-20160816; b=XzrClcY5ThSv0JCxuMJAk5Bwr+PW/vS8ifcZjmtZRLsl1vljWb7cN28j0P0FZ9dxTI bYgRob7Rp12w3ITYB50IJ56ZcBLWjWZmfhn71mR1XawvkAYlzAFiGN2j66dAby8Q/qTG a46qLYsbxSOAigXrTZCjs9giLQphhmJqqBHm1gyRITynCkAO2vQdNt7KuDZktw12IUcj 1RKw92k2gkYISMJJlwikelNaFfaHF7SBebi/qZqdgkJVg7HOfasImL4ID5lO5p4LdGdD +Gf8ioJ156Dibgmasq7LXW3r2oIjddFIIkove9LxDGpAxvjC5ZiPHjZViTxeOZI/KYRC +Bmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=JWddQhLbJltZChAxH4GYtTEtJ7ClCErAeuGJc/K8gq0=; b=wY+8tKY23fCYELuiGVcZ+zKBy3SRPXu3Wqn1oEnictnhRf2nEXr3tyWCFTRqUVzRnJ 7M9gkWTtDKtHXkgzOazpYF41/mbDfUVePQqSSj8DBR4Ny1jbkGKOlFuXcbeMQsQllfvi iNv5SagCvgp8Zz1scs7ZHFZClzxx3besZR2KHTU+ocotxjYCzs/KLxy784fYkFjrkzYX DKYShU2hlKyOFw70i8OnCP/pqOgra4m8lk2lREAMqqMhaYKVYfu403WhVB1iQ8v+L5zD mYTpzXeiPAOj3kghiREYScWAz7UXCFoJRuZHXqwb42LlB7xxkuivW+34tuINMRFiLt4l gIoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=liSVNiiv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si5034880pfh.12.2018.04.13.06.50.49; Fri, 13 Apr 2018 06:51:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=liSVNiiv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754553AbeDMNfY (ORCPT + 99 others); Fri, 13 Apr 2018 09:35:24 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:34995 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754239AbeDMNfW (ORCPT ); Fri, 13 Apr 2018 09:35:22 -0400 Received: by mail-yw0-f195.google.com with SMTP id i144so3440107ywc.2; Fri, 13 Apr 2018 06:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JWddQhLbJltZChAxH4GYtTEtJ7ClCErAeuGJc/K8gq0=; b=liSVNiivLr8ou0bjiKcTgRL47W+V+WPGHHlE7qotQ4f7502s5uYtuBnRWE9t5Z8sMa lbBKQXIUg3JxhYSLIEMPlJqcVwMuY9LhnBhqwT5amaBceUvJZoWVi2tUcqmnCB7azZaF pYKxrDb8m15JUPq9ZNaQQXr1MdXXuG17vo9R9wBuBlUBsmj3twCYU2YMe9Pa0n2zS2yt EPaAUK9e0LPhG+h1X777TC07mSTB0YW3JXm13Aib7nT47gc2eG0q9jfFxXH70Dab3Fqx B4pTJvg1cvi1xWkuqNUqh3TpYkyFLmLHdOujpaICr+GmHA0Z6RQTAuXnLvWkj8SwXQ3o pohA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JWddQhLbJltZChAxH4GYtTEtJ7ClCErAeuGJc/K8gq0=; b=MZ+kJotWtsEkFz9wRErLFR470mNMmXRJFxIZnD+2M879iKq49qKLp8anMlY5aEVPe1 DA1AxSCSAUYBSlqzuhLT5JnRreiYpkzHHubWqwXxfb07hJ3gGtdQbBjJ4IN6PVvfMar2 dFBhZtRALYsCr4XyxvZzkCMGGTW7G4MDa9d04cWzirdIN1xRRNhjOeakG1Jg3xuUGPsn 3xbK0TKcMhwISUxIQuh2awJ33OG0ntPNF1m745w40sQCC0KiSTHdG7ZuWqRg69dPta0H YSAmjGjtZBNroVTKugbnW9XyWjbazW2SsK2U+BHRxv/dWoxjelcI0T4SR9FKaH/5ZqgJ mgZQ== X-Gm-Message-State: ALQs6tBNV2lug1K17GLvFIPAVsYqzutYAznC2FFGYWi/jH5ylMnTiN09 92d6e1DGnmz4nGALfugsr6gf9wEPiJfmYogRHJ0= X-Received: by 10.129.112.12 with SMTP id l12mr4634464ywc.181.1523626522164; Fri, 13 Apr 2018 06:35:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.183.12 with HTTP; Fri, 13 Apr 2018 06:35:21 -0700 (PDT) In-Reply-To: <20180412150826.20988-12-mszeredi@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> <20180412150826.20988-12-mszeredi@redhat.com> From: Amir Goldstein Date: Fri, 13 Apr 2018 16:35:21 +0300 Message-ID: Subject: Re: [RFC PATCH 11/35] ovl: readd read_iter To: Miklos Szeredi Cc: overlayfs , linux-fsdevel , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 12, 2018 at 6:08 PM, Miklos Szeredi wrote: > Implement stacked reading. > I couldn't decipher the meaning of "readd" in the subject of this and other file ops pacthes?? > Signed-off-by: Miklos Szeredi > --- > fs/overlayfs/file.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c > index 409b542ff30c..a19429c5965d 100644 > --- a/fs/overlayfs/file.c > +++ b/fs/overlayfs/file.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include "overlayfs.h" > > static struct file *ovl_open_realfile(const struct file *file) > @@ -129,8 +130,63 @@ static loff_t ovl_llseek(struct file *file, loff_t offset, int whence) > i_size_read(realinode)); > } > > +static void ovl_file_accessed(struct file *file) > +{ > + struct inode *inode = file_inode(file); > + > + if ((file->f_flags & O_NOATIME) || !ovl_inode_upper(inode)) > + return; > + > + ovl_copytimes(inode); > + touch_atime(&file->f_path); > +} > + > +static rwf_t ovl_iocb_to_rwf(struct kiocb *iocb) > +{ > + int ifl = iocb->ki_flags; > + rwf_t flags = 0; > + > + if (ifl & IOCB_NOWAIT) > + flags |= RWF_NOWAIT; > + if (ifl & IOCB_HIPRI) > + flags |= RWF_HIPRI; > + if (ifl & IOCB_DSYNC) > + flags |= RWF_DSYNC; > + if (ifl & IOCB_SYNC) > + flags |= RWF_SYNC; > + > + return flags; > +} > + > +static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) > +{ > + struct file *file = iocb->ki_filp; > + struct fd real; > + const struct cred *old_cred; > + ssize_t ret; > + > + if (!iov_iter_count(iter)) > + return 0; > + > + ret = ovl_real_file(file, &real); > + if (ret) > + return ret; > + > + old_cred = ovl_override_creds(file_inode(file)->i_sb); > + ret = vfs_iter_read(real.file, iter, &iocb->ki_pos, > + ovl_iocb_to_rwf(iocb)); > + revert_creds(old_cred); > + > + ovl_file_accessed(file); > + > + fdput(real); I find it confusing that the name of ovl_real_file() does not suggest it may take a reference, so this fdput() looks unbalanced. All other ovl_XXX_{real,upper,lower} helpers do not take a reference. Perhaps something along the lines of ovl_file_real_fdget(). Thanks, Amir.