From patchwork Thu Jul 7 07:37:53 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: 9217921 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 5D88160467 for ; Thu, 7 Jul 2016 07:33:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 535FB2876A for ; Thu, 7 Jul 2016 07:33:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4799F2876E; Thu, 7 Jul 2016 07:33:18 +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=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 E7CA72876A for ; Thu, 7 Jul 2016 07:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756273AbcGGHcd (ORCPT ); Thu, 7 Jul 2016 03:32:33 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:55812 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756266AbcGGHba (ORCPT ); Thu, 7 Jul 2016 03:31:30 -0400 Received: from 172.24.1.136 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DNI96757; Thu, 07 Jul 2016 15:31:23 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.235.1; Thu, 7 Jul 2016 15:31:13 +0800 From: To: , , CC: zhangaihua Subject: [PATCH] ovl:support fsinotify on overlayfs. Date: Thu, 7 Jul 2016 15:37:53 +0800 Message-ID: <1467877073-32109-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.0A020202.577E054F.0035, 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: d17b26fc30becf6cae6b642712a66c26 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: zhangaihua fix the inode to suppoert fsinotify, the inode should point to overlay rather than upper. before patch: [root@localhost bin]# ./inotify01 inotify01 1 TPASS : get event: wd=1 mask=4 cookie=0 len=0 inotify01 2 TFAIL : inotify01.c:185: didn't get event: mask=20 inotify01 3 TFAIL : inotify01.c:185: didn't get event: mask=1 inotify01 4 TFAIL : inotify01.c:185: didn't get event: mask=10 inotify01 5 TFAIL : inotify01.c:185: didn't get event: mask=20 inotify01 6 TFAIL : inotify01.c:185: didn't get event: mask=2 inotify01 7 TFAIL : inotify01.c:185: didn't get event: mask=8 after patch: [root@localhost bin]# ./inotify01 inotify01 1 TPASS : get event: wd=1 mask=4 cookie=0 len=0 inotify01 2 TPASS : get event: wd=1 mask=20 cookie=0 len=0 inotify01 3 TPASS : get event: wd=1 mask=1 cookie=0 len=0 inotify01 4 TPASS : get event: wd=1 mask=10 cookie=0 len=0 inotify01 5 TPASS : get event: wd=1 mask=20 cookie=0 len=0 inotify01 6 TPASS : get event: wd=1 mask=2 cookie=0 len=0 inotify01 7 TPASS : get event: wd=1 mask=8 cookie=0 len=0 Signed-off-by: Aihua Zhang --- include/linux/fsnotify.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 7ee1774..ccd8395 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -194,7 +194,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) static inline void fsnotify_access(struct file *file) { struct path *path = &file->f_path; - struct inode *inode = file_inode(file); + struct inode *inode = path->dentry->d_inode; __u32 mask = FS_ACCESS; if (S_ISDIR(inode->i_mode)) @@ -212,8 +212,8 @@ static inline void fsnotify_access(struct file *file) static inline void fsnotify_modify(struct file *file) { struct path *path = &file->f_path; - struct inode *inode = file_inode(file); + struct inode *inode = path->dentry->d_inode; __u32 mask = FS_MODIFY; if (S_ISDIR(inode->i_mode)) mask |= FS_ISDIR; @@ -230,7 +230,7 @@ static inline void fsnotify_modify(struct file *file) static inline void fsnotify_open(struct file *file) { struct path *path = &file->f_path; - struct inode *inode = file_inode(file); + struct inode *inode = path->dentry->d_inode; __u32 mask = FS_OPEN; if (S_ISDIR(inode->i_mode)) @@ -246,8 +246,8 @@ static inline void fsnotify_open(struct file *file) static inline void fsnotify_close(struct file *file) { struct path *path = &file->f_path; - struct inode *inode = file_inode(file); + struct inode *inode = path->dentry->d_inode; fmode_t mode = file->f_mode; __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; if (S_ISDIR(inode->i_mode))