ovl: Add an inode flag OVL_CONST_INO
authorVivek Goyal <vgoyal@redhat.com>
Fri, 11 May 2018 15:49:32 +0000 (11:49 -0400)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 20 Jul 2018 07:56:14 +0000 (09:56 +0200)
Add an ovl_inode flag OVL_CONST_INO.  This flag signifies if inode number
will remain constant over copy up or not.  This flag does not get updated
over copy up and remains unmodifed after setting once.

Next patch in the series will make use of this flag.  It will basically
figure out if dentry is of type ORIGIN or not.  And this can be derived by
this flag.

ORIGIN = (upperdentry && ovl_test_flag(OVL_CONST_INO, inode)).

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/inode.c
fs/overlayfs/overlayfs.h

index 12553274eae70fb05df72ad1044ef31600554c0b..7c7092aaf9b40912120b5f0c3ba8a642265a04e3 100644 (file)
@@ -883,6 +883,9 @@ struct inode *ovl_get_inode(struct super_block *sb,
 
        OVL_I(inode)->redirect = oip->redirect;
 
+       if (bylower)
+               ovl_set_flag(OVL_CONST_INO, inode);
+
        /* Check for non-merge dir that may have whiteouts */
        if (is_dir) {
                if (((upperdentry && lowerdentry) || oip->numlower > 1) ||
index 99f79390480172ab4de1cfd790efa06a3a87ff47..a6b466b30f2be2d55ec1c6e07e7bda59fbfecb93 100644 (file)
@@ -38,6 +38,8 @@ enum ovl_inode_flag {
        OVL_WHITEOUTS,
        OVL_INDEX,
        OVL_UPPERDATA,
+       /* Inode number will remain constant over copy up. */
+       OVL_CONST_INO,
 };
 
 enum ovl_entry_flag {