Skip to contentSkip to conversation

ovl: implement stacked mmap for shared map

RFC PATCH Chen 2 participants 2 messages Aug 30, 2020 – Sep 10, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Chen

#1 lore raw
Quoted 27 lines · cgxu
Quoted 26 lines · kernel test robot

Hi Chengguang,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on miklos-vfs/overlayfs-next]
[also build test ERROR on v5.9-rc2 next-20200828]
[cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Chengguang-Xu/ovl-stacked-mmap-for-shared-map/20200829-175321
base:
https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git
overlayfs-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
         wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O ~/bin/make.cross
         chmod +x ~/bin/make.cross

         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 
make.cross ARCH=sh
Quoted 5 lines
Quoted 2 lines

If you fix the issue, kindly add following tag as appropriate

It seems missed applying two previous patches in the patch set, actually, the patch set is based on miklos-vfs/overlayfs-next.

Hi Chengguang,

Thanks for the feedback, we'll take a look.

Best Regards,
Rong Chen

Quoted 128 lines

cgxu

Quoted 124 lines

All error/warnings (new ones prefixed by >>):

    fs/overlayfs/file.c:37:14: warning: no previous prototype for 'ovl_get_realfile' [-Wmissing-prototypes]
       37 | struct file *ovl_get_realfile(struct file *file) |              ^~~~~~~~~~~~~~~~ fs/overlayfs/file.c:44:6: warning: no previous prototype for 'ovl_set_realfile' [-Wmissing-prototypes]
       44 | void ovl_set_realfile(struct file *file, struct file *realfile)
          |      ^~~~~~~~~~~~~~~~ fs/overlayfs/file.c:51:36: warning: no previous prototype for 'ovl_get_real_vmops' [-Wmissing-prototypes]
       51 | const struct vm_operations_struct *ovl_get_real_vmops(struct file *file)
          | ^~~~~~~~~~~~~~~~~~ fs/overlayfs/file.c:58:6: warning: no previous prototype for 'ovl_set_real_vmops' [-Wmissing-prototypes]
       58 | void ovl_set_real_vmops(struct file *file, |      ^~~~~~~~~~~~~~~~~~ fs/overlayfs/file.c: In function 'ovl_fault':

Quoted 2 lines
Quoted 2 lines

fs/overlayfs/file.c:518:6: error: implicit declaration of function 'fault_flag_check' [-Werror=implicit-function-declaration]

      518 |  if (fault_flag_check(vmf, FAULT_FLAG_TRIED)) { |      ^~~~~~~~~~~~~~~~

Quoted 2 lines
Quoted 2 lines

fs/overlayfs/file.c:551:10: error: implicit declaration of function 'maybe_unlock_mmap_for_io' [-Werror=implicit-function-declaration]

      551 |   fpin = maybe_unlock_mmap_for_io(vmf, NULL); |          ^~~~~~~~~~~~~~~~~~~~~~~~

Quoted 3 lines
Quoted 3 lines

fs/overlayfs/file.c:551:8: warning: assignment to 'struct file *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      551 |   fpin = maybe_unlock_mmap_for_io(vmf, NULL); |        ^
    cc1: some warnings being treated as errors

#
https://github.com/0day-ci/linux/commit/a33b1899ccf797aa55f56333a2700cfbc67487cc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chengguang-Xu/ovl-stacked-mmap-for-shared-map/20200829-175321 git checkout a33b1899ccf797aa55f56333a2700cfbc67487cc vim +/fault_flag_check +518 fs/overlayfs/file.c

    504
    505    vm_fault_t ovl_fault(struct vm_fault *vmf)
    506    {
    507        struct vm_area_struct *vma = vmf->vma;
    508        struct file *file = vma->vm_file;
    509        struct file *realfile;
    510        struct file *fpin, *tmp;
    511        struct inode *inode = file_inode(file);
    512        struct inode *realinode;
    513        const struct cred *old_cred;
    514        bool retry_allowed;
    515        vm_fault_t ret;
    516        int err = 0;
    517
  > 518        if (fault_flag_check(vmf, FAULT_FLAG_TRIED)) { 519            realfile = ovl_get_realfile(file);
    520
    521            if (!ovl_has_upperdata(inode) ||
    522                realfile->f_inode != ovl_inode_upper(inode) || 523                !realfile->f_op->mmap)
    524                return VM_FAULT_SIGBUS;
    525
    526            if (!ovl_get_real_vmops(file)) {
    527                old_cred = ovl_override_creds(inode->i_sb); 528                err = call_mmap(realfile, vma);
    529                revert_creds(old_cred);
    530
    531                vma->vm_file = file;
    532                if (err) {
    533                    vma->vm_ops = &ovl_vm_ops;
    534                    return VM_FAULT_SIGBUS;
    535                }
    536                ovl_set_real_vmops(file, vma->vm_ops); 537                vma->vm_ops = &ovl_vm_ops;
    538            }
    539
    540            retry_allowed = fault_flag_check(vmf, FAULT_FLAG_ALLOW_RETRY);
    541            if (retry_allowed)
    542                vma->vm_flags &= ~FAULT_FLAG_ALLOW_RETRY; 543            vma->vm_file = realfile;
    544            ret = ovl_get_real_vmops(file)->fault(vmf); 545            vma->vm_file = file;
    546            if (retry_allowed)
    547                vma->vm_flags |= FAULT_FLAG_ALLOW_RETRY; 548            return ret;
    549
    550        } else {
  > 551            fpin = maybe_unlock_mmap_for_io(vmf, NULL); 552            if (!fpin)
    553                return VM_FAULT_SIGBUS;
    554
    555            ret = VM_FAULT_RETRY;
    556            if (!ovl_has_upperdata(inode)) {
    557                err = ovl_copy_up_with_data(file->f_path.dentry); 558                if (err)
    559                    goto out;
    560            }
    561
    562            realinode = ovl_inode_realdata(inode); 563            realfile = ovl_open_realfile(file, realinode); 564            if (IS_ERR(realfile))
    565                goto out;
    566
    567            tmp = ovl_get_realfile(file);
    568            ovl_set_realfile(file, realfile);
    569            fput(tmp);
    570
    571    out:
    572            fput(fpin);
    573            return ret;
    574        }
    575    }
    576

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw
In reply to a message not in the archive
Quoted 27 lines · cgxu
Quoted 26 lines · kernel test robot

Hi Chengguang,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on miklos-vfs/overlayfs-next]
[also build test ERROR on v5.9-rc2 next-20200828]
[cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Chengguang-Xu/ovl-stacked-mmap-for-shared-map/20200829-175321
base:
https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git
overlayfs-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
         wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
-O ~/bin/make.cross
         chmod +x ~/bin/make.cross

         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 
make.cross ARCH=sh
Quoted 5 lines
Quoted 2 lines

If you fix the issue, kindly add following tag as appropriate

It seems missed applying two previous patches in the patch set, actually, the patch set is based on miklos-vfs/overlayfs-next.

Hi cgxu,

The bot applied the patch set based on commit 4518dfcf761e3 which can be also found in miklos-vfs/overlayfs-next,
is the base commit not correct? or could you provide the base commit you used.

a33b1899ccf79 ovl: implement stacked mmap for shared map af28de469a59c ovl: introduce struct ovl_file_entry 3229f1dd50299 mm: mmap: export necessary functions for overlayfs' mmap 4518dfcf761e3 ovl: fix lookup of indexed hardlinks with metacopy

Best Regards,
Rong Chen

Quoted 128 lines

cgxu

Quoted 124 lines

All error/warnings (new ones prefixed by >>):

    fs/overlayfs/file.c:37:14: warning: no previous prototype for 'ovl_get_realfile' [-Wmissing-prototypes]
       37 | struct file *ovl_get_realfile(struct file *file) |              ^~~~~~~~~~~~~~~~ fs/overlayfs/file.c:44:6: warning: no previous prototype for 'ovl_set_realfile' [-Wmissing-prototypes]
       44 | void ovl_set_realfile(struct file *file, struct file *realfile)
          |      ^~~~~~~~~~~~~~~~ fs/overlayfs/file.c:51:36: warning: no previous prototype for 'ovl_get_real_vmops' [-Wmissing-prototypes]
       51 | const struct vm_operations_struct *ovl_get_real_vmops(struct file *file)
          | ^~~~~~~~~~~~~~~~~~ fs/overlayfs/file.c:58:6: warning: no previous prototype for 'ovl_set_real_vmops' [-Wmissing-prototypes]
       58 | void ovl_set_real_vmops(struct file *file, |      ^~~~~~~~~~~~~~~~~~ fs/overlayfs/file.c: In function 'ovl_fault':

Quoted 2 lines
Quoted 2 lines

fs/overlayfs/file.c:518:6: error: implicit declaration of function 'fault_flag_check' [-Werror=implicit-function-declaration]

      518 |  if (fault_flag_check(vmf, FAULT_FLAG_TRIED)) { |      ^~~~~~~~~~~~~~~~

Quoted 2 lines
Quoted 2 lines

fs/overlayfs/file.c:551:10: error: implicit declaration of function 'maybe_unlock_mmap_for_io' [-Werror=implicit-function-declaration]

      551 |   fpin = maybe_unlock_mmap_for_io(vmf, NULL); |          ^~~~~~~~~~~~~~~~~~~~~~~~

Quoted 3 lines
Quoted 3 lines

fs/overlayfs/file.c:551:8: warning: assignment to 'struct file *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

      551 |   fpin = maybe_unlock_mmap_for_io(vmf, NULL); |        ^
    cc1: some warnings being treated as errors

#
https://github.com/0day-ci/linux/commit/a33b1899ccf797aa55f56333a2700cfbc67487cc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chengguang-Xu/ovl-stacked-mmap-for-shared-map/20200829-175321 git checkout a33b1899ccf797aa55f56333a2700cfbc67487cc vim +/fault_flag_check +518 fs/overlayfs/file.c

    504
    505    vm_fault_t ovl_fault(struct vm_fault *vmf)
    506    {
    507        struct vm_area_struct *vma = vmf->vma;
    508        struct file *file = vma->vm_file;
    509        struct file *realfile;
    510        struct file *fpin, *tmp;
    511        struct inode *inode = file_inode(file);
    512        struct inode *realinode;
    513        const struct cred *old_cred;
    514        bool retry_allowed;
    515        vm_fault_t ret;
    516        int err = 0;
    517
  > 518        if (fault_flag_check(vmf, FAULT_FLAG_TRIED)) { 519            realfile = ovl_get_realfile(file);
    520
    521            if (!ovl_has_upperdata(inode) ||
    522                realfile->f_inode != ovl_inode_upper(inode) || 523                !realfile->f_op->mmap)
    524                return VM_FAULT_SIGBUS;
    525
    526            if (!ovl_get_real_vmops(file)) {
    527                old_cred = ovl_override_creds(inode->i_sb); 528                err = call_mmap(realfile, vma);
    529                revert_creds(old_cred);
    530
    531                vma->vm_file = file;
    532                if (err) {
    533                    vma->vm_ops = &ovl_vm_ops;
    534                    return VM_FAULT_SIGBUS;
    535                }
    536                ovl_set_real_vmops(file, vma->vm_ops); 537                vma->vm_ops = &ovl_vm_ops;
    538            }
    539
    540            retry_allowed = fault_flag_check(vmf, FAULT_FLAG_ALLOW_RETRY);
    541            if (retry_allowed)
    542                vma->vm_flags &= ~FAULT_FLAG_ALLOW_RETRY; 543            vma->vm_file = realfile;
    544            ret = ovl_get_real_vmops(file)->fault(vmf); 545            vma->vm_file = file;
    546            if (retry_allowed)
    547                vma->vm_flags |= FAULT_FLAG_ALLOW_RETRY; 548            return ret;
    549
    550        } else {
  > 551            fpin = maybe_unlock_mmap_for_io(vmf, NULL); 552            if (!fpin)
    553                return VM_FAULT_SIGBUS;
    554
    555            ret = VM_FAULT_RETRY;
    556            if (!ovl_has_upperdata(inode)) {
    557                err = ovl_copy_up_with_data(file->f_path.dentry); 558                if (err)
    559                    goto out;
    560            }
    561
    562            realinode = ovl_inode_realdata(inode); 563            realfile = ovl_open_realfile(file, realinode); 564            if (IS_ERR(realfile))
    565                goto out;
    566
    567            tmp = ovl_get_realfile(file);
    568            ovl_set_realfile(file, realfile);
    569            fput(tmp);
    570
    571    out:
    572            fput(fpin);
    573            return ret;
    574        }
    575    }
    576

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org