From patchwork Fri Sep 7 14:18:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1422761 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 43F5E3FC85 for ; Fri, 7 Sep 2012 14:21:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753283Ab2IGOVb (ORCPT ); Fri, 7 Sep 2012 10:21:31 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:48299 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760763Ab2IGOTE (ORCPT ); Fri, 7 Sep 2012 10:19:04 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so3363912vbb.19 for ; Fri, 07 Sep 2012 07:19:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=Lq9xE178WwXGYEqAzleZYkw29f7RBnfZFNb0Uh8l3es=; b=G64/YGdJ39F9q95OfXMhaZVcEyy4mtYBh/JiEovp4cC5Dy1pe597roQsoEa2lDNXyh hB3caHheq1e0bAWZrR6u0kPEhOQj09b5SDhnmfFMJCHK5gdv2xSYC0qPrrGdy5CsLbkH hYymBQAs+XfD1IqoxQfVYUyFCG6ybmN5Vk1Avt7h7w6zOcDm4BBTJEgqdjpvZv+Ud6tV 98WXhN6T5yeI2EJBJ0umi/C7DPZ7owLcgbudwXKN03W1qexEoX2RbGTGn2gZ3zv9MvEF RGb2DhHWD2NQgSDXOIJTjsuoC8XLK/7A+tbPOnfRkwuWFDs/cJyM9QziXuFG1K35zx1w Lj2w== Received: by 10.220.119.204 with SMTP id a12mr7255988vcr.66.1347027543631; Fri, 07 Sep 2012 07:19:03 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-069-134-145-027.nc.res.rr.com. [69.134.145.27]) by mx.google.com with ESMTPS id v9sm3207113ves.8.2012.09.07.07.19.01 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 07:19:03 -0700 (PDT) From: Jeff Layton To: viro@ZenIV.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, michael.brantley@deshaw.com, hch@infradead.org, miklos@szeredi.hu, pstaubach@exagrid.com Subject: [PATCH v6 18/20] vfs: make fchownat retry once on ESTALE errors Date: Fri, 7 Sep 2012 10:18:25 -0400 Message-Id: <1347027507-20956-19-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347027507-20956-1-git-send-email-jlayton@redhat.com> References: <1347027507-20956-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQncDtk3pNFenCwk871Op/ez74dRUIpxwRJ5S676K2dChnj7ooNzi9VOOFB970izDlXW1eIA Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Jeff Layton --- fs/open.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/fs/open.c b/fs/open.c index 232cbfb..1bdfd9a 100644 --- a/fs/open.c +++ b/fs/open.c @@ -567,24 +567,29 @@ SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, struct path path; int error = -EINVAL; int lookup_flags; + unsigned int try = 0; if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0) - goto out; + return error; lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; if (flag & AT_EMPTY_PATH) lookup_flags |= LOOKUP_EMPTY; - error = user_path_at(dfd, filename, lookup_flags, &path); - if (error) - goto out; - error = mnt_want_write(path.mnt); - if (error) - goto out_release; - error = chown_common(&path, user, group); - mnt_drop_write(path.mnt); -out_release: - path_put(&path); -out: + + do { + error = user_path_at(dfd, filename, lookup_flags, &path); + if (error) + break; + + error = mnt_want_write(path.mnt); + if (!error) { + error = chown_common(&path, user, group); + mnt_drop_write(path.mnt); + } + + path_put(&path); + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); return error; }