From patchwork Mon May 7 08:37:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10383621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2FD860159 for ; Mon, 7 May 2018 08:48:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9DC928B60 for ; Mon, 7 May 2018 08:48:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF01528B64; Mon, 7 May 2018 08:48:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CE9828B60 for ; Mon, 7 May 2018 08:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752331AbeEGIr0 (ORCPT ); Mon, 7 May 2018 04:47:26 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36929 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752142AbeEGIib (ORCPT ); Mon, 7 May 2018 04:38:31 -0400 Received: by mail-wm0-f66.google.com with SMTP id l1-v6so13848228wmb.2 for ; Mon, 07 May 2018 01:38:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=61zAqqEAQR4Hg25J5/0SMmQbRDGqsYyewogZEhh+MnM=; b=kVy5ooJyLxzd3l2E6GnZz+SAWmpROCm4v/wzUcCQ/MlCt8098Hu1fnu23VF7k+49gH N2nrtK7T1olUTHUZDspKsnMtz4zbN6peGYEe7AyIkw8a/vtbW4pjfmhVgw559o2iqE+C WzonWDDlHxVuPQUpDay9x8SNAE06jRS1iBgcxk+097ojZbvLRlcOyKWRNti6S5PvH3F5 BsTfiA0a9DtlSfcVXjAiGQMciGdvdvgz9YWdiMq6Ftwk+3PNgeisSi1X82E4hgwfoQ0a YTeVy/A2jojYyzEnsVVJhNBoq1dB2cWOL+ZIDg/M+iHWIyYW2/LCU15lWJ91qrlka+Hb zfvg== X-Gm-Message-State: ALKqPwc2Bqiq84sgwu7VS5jr+jLcRA1OOOE/f96syGPQqOUfH6tlYsHe tEYJIhCmMW7Q1QD5s9AUgS0dfZCN1KY= X-Google-Smtp-Source: AB8JxZqKTVNokt3N/W23kVecJD0L64mZ0EAaBKbzhWyESydBrqFtNxDr9BNUniX6knSRh050E6WDrw== X-Received: by 2002:a1c:ec4b:: with SMTP id k72-v6mr180141wmh.27.1525682310375; Mon, 07 May 2018 01:38:30 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (C2B0E321.catv.pool.telekom.hu. [194.176.227.33]) by smtp.gmail.com with ESMTPSA id h8-v6sm5908050wmc.16.2018.05.07.01.38.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 01:38:29 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 15/35] ovl: add ovl_fsync() Date: Mon, 7 May 2018 10:37:47 +0200 Message-Id: <20180507083807.28792-16-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507083807.28792-1-mszeredi@redhat.com> References: <20180507083807.28792-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Implement stacked fsync(). Signed-off-by: Miklos Szeredi --- fs/overlayfs/file.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index a7af56861aa5..419aa3f9967b 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -233,10 +233,30 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) return ret; } +static int ovl_fsync(struct file *file, loff_t start, loff_t end, int datasync) +{ + struct fd real; + const struct cred *old_cred; + int ret; + + ret = ovl_real_fdget(file, &real); + if (ret) + return ret; + + old_cred = ovl_override_creds(file_inode(file)->i_sb); + ret = vfs_fsync_range(real.file, start, end, datasync); + revert_creds(old_cred); + + fdput(real); + + return ret; +} + const struct file_operations ovl_file_operations = { .open = ovl_open, .release = ovl_release, .llseek = ovl_llseek, .read_iter = ovl_read_iter, .write_iter = ovl_write_iter, + .fsync = ovl_fsync, };