0

能否解决overlayfs中修改upperdir路径时不知道inode信息的问题?

更改upperdir路径后:

root@bcd0d4e391f8:~/myDir# ls -i   
ls: cannot access 'ssd.c': No such file or directory  
ls: cannot access 'ssd.abc': No such file or directory  
? ssd.abc  ? ssd.c

*通过更改overlayfs代码修改了upperdir路径。


*原始代码

static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
            struct ovl_cattr *attr){    

    struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
    struct inode *udir = upperdir->d_inode;
    struct dentry *newdentry;
    int err;

    newdentry = ovl_create_real(udir,
                lookup_one_len(dentry->d_name.name,
                       upperdir,
                       dentry->d_name.len),
                attr);

*修复代码示例

static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
            struct ovl_cattr *attr){
     struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
     struct inode *udir = upperdir->d_inode;
     struct dentry *newdentry;
     int err;
     extern struct qsh_metadata qsh_mt; //HOON  

     newdentry = ovl_create_real(qsh_mt.qsh_dentry->d_inode,
            lookup_one_len(dentry->d_name.name,
                    qsh_mt.qsh_dentry,
                    dentry->d_name.len),
                attr);

*在上面的代码中,我用我想要的磁盘和挂载的dentry对象替换了upperdir部分。*外部结构 qsh_metadata qsh_mt; => 我添加的代码

ex) struct dentry upperdir = qsh_dentry;
码头基地挂载:/dev/sda
qsh_dentry:挂载/dev/sdb

4

0 回答 0