Received: by 10.192.165.156 with SMTP id m28csp2091246imm; Thu, 12 Apr 2018 08:28:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx49qbA+UVzkr9dIeYiJao6ECmy20saz4M97kWmCupifO3Is1t6Rw13WnJmZGTwjMFSE30YIJ X-Received: by 10.99.97.151 with SMTP id v145mr1061832pgb.307.1523546894712; Thu, 12 Apr 2018 08:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523546894; cv=none; d=google.com; s=arc-20160816; b=w5rL2K7kBA3EM4b3g+vG+pK7YONRqCJ2ijLG19cCWRer/apeNcWBdi9eAtpzK8IuQh u7Oq2LbJI16cFHJBadZBwZFv5XhZKqaI7oc07sKmC0VRgT6u50CXSK55TMtZD8dQwTbu MIwi7Y6ew0cnkZuTtOao/JVfkK44FsvPhjQVwTlGCgZ7xKL5I9b/OuyPQi1cN9GoI2fd 6NvwYFrkI8HrswU94+thiXbeFebvW1LPODwvC/kbiPyNc8HCHyu+2Jg4Ddnm0IXjoxZx aOyWC3oRy7d0r2WqHXgDWR/jX8tlgwmVmM84MqYuIdS1Kd4w/CE6V26UISwBDFQbShZ4 fTeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=p+GqBhBJPkLBIFdOTVqXKQ1CFbZgTdx6ybOzCqvteCw=; b=uQ0EYqWRS7Fi7/wo6FeYgOSob7giak+B98CuUrzWeeF1B22qC1i7S1bNMrW2NFDnqp 9vkSUIki1rzTpVYDnCitNH4NFbXJJmjFxzj5TrUeebmW1uMwU7O8QBzvpN99Cb5ZWXFn qtsydSGSYGhI6hrjuT9iUs049x8fiwvXj51AYXq5AuAzhwUQ0+YGVUvUZWFoDuOEICcD mJvtG4gR8OD/e+PBrCtX/fqElDcaKAL3KqhsyENIj0ufDGkZ7hBiTdB4SEfSEgvkilR7 wBvVJFtdhNv7lbMzpa9XdyLI5OqTLborI1ivQ3AGfeSs9q0UwhmiAZ5cXbFg7rfkhkiD 323Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 o69si2703214pfi.322.2018.04.12.08.27.37; Thu, 12 Apr 2018 08:28:14 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754140AbeDLPVo (ORCPT + 99 others); Thu, 12 Apr 2018 11:21:44 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38295 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752943AbeDLPIr (ORCPT ); Thu, 12 Apr 2018 11:08:47 -0400 Received: by mail-wm0-f67.google.com with SMTP id i3so10171783wmf.3 for ; Thu, 12 Apr 2018 08:08:47 -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=p+GqBhBJPkLBIFdOTVqXKQ1CFbZgTdx6ybOzCqvteCw=; b=Hjq7MJ1ZZ3oEroJpRdz57KQkCvx/x9ub71nqTsoj6/CStBaP8+M+5f4TUaGor6Y7c6 O7xYcSLlW2dTcLX9hlkt++Na78AMbQZ0m5tEavWpxXRFsGql8npbtkhuz0XSwpSCJJo1 j68jPF8wExf1D4rpbANzAeJswi3+AsLwR0dKThlWnRchklx52GJ7SsKR+5cr/eUQDUAB NeB7eEf/0sne/Yeeph8V3XgUBxBq1gGA4pk3lVXW7Q67xyU8RNZkA0mnFqgctmVUrFow jBF8Tp4d618vam9yJAXy2bY6/UzsckKi5EmYcHBaAInvv3n3q8keU4mDrnaxuQP0ZWXg NTww== X-Gm-Message-State: ALQs6tD06aWW4Nvh8biss10RT77JtD4Z9RGXT0MF3nxewqIrvgq3SciE hM7NrkAkShtOnb7/dwh7Ji71zQ== X-Received: by 10.28.150.71 with SMTP id y68mr1071680wmd.139.1523545726782; Thu, 12 Apr 2018 08:08:46 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-176-63-54-97.catv.broadband.hu. [176.63.54.97]) by smtp.gmail.com with ESMTPSA id p197sm2621783wme.43.2018.04.12.08.08.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 08:08:46 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 13/35] ovl: readd fsync Date: Thu, 12 Apr 2018 17:08:04 +0200 Message-Id: <20180412150826.20988-14-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180412150826.20988-1-mszeredi@redhat.com> References: <20180412150826.20988-1-mszeredi@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 b98204c1c19c..4417527667ff 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -222,10 +222,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_file(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, }; -- 2.14.3