From patchwork Fri Jul 29 08:06:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangaihua1@huawei.com X-Patchwork-Id: 9252249 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 6929F601C0 for ; Fri, 29 Jul 2016 08:01:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C5C427D9B for ; Fri, 29 Jul 2016 08:01:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D1127F8F; Fri, 29 Jul 2016 08:01:32 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 0C63227D9B for ; Fri, 29 Jul 2016 08:01:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752118AbcG2IBO (ORCPT ); Fri, 29 Jul 2016 04:01:14 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:54287 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbcG2IBN (ORCPT ); Fri, 29 Jul 2016 04:01:13 -0400 Received: from 172.24.1.60 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.60]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DKX66586; Fri, 29 Jul 2016 16:00:05 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Fri, 29 Jul 2016 15:59:56 +0800 From: To: , , CC: Aihua Zhang Subject: [PATCH] ovl: fix inode in utimes_common on overlayfs. Date: Fri, 29 Jul 2016 16:06:19 +0800 Message-ID: <1469779579-28423-1-git-send-email-zhangaihua1@huawei.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.579B0D40.0052, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 74e612cef8f0c6b3c882201abbadbadc 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 From: Aihua Zhang the check IS_IMMUTABLE(inode) is invalid in utimes_commmon, the inode should point to upper rather than merge. the patch also fix the error in LTP(utimensat01). Signed-off-by: Aihua Zhang --- fs/utimes.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/utimes.c b/fs/utimes.c index 85c40f4..1813a62 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -53,6 +53,7 @@ static int utimes_common(struct path *path, struct timespec *times) int error; struct iattr newattrs; struct inode *inode = path->dentry->d_inode; + struct inode *real_inode = d_real(path->dentry)->d_inode; struct inode *delegated_inode = NULL; error = mnt_want_write(path->mnt); @@ -93,7 +94,7 @@ static int utimes_common(struct path *path, struct timespec *times) * inode_change_ok() won't do it. */ error = -EACCES; - if (IS_IMMUTABLE(inode)) + if (IS_IMMUTABLE(real_inode)) goto mnt_drop_write_and_out; if (!inode_owner_or_capable(inode)) {