jffs2文件系统不支持export的问题

来源:互联网 发布:苹果电脑系统修复软件 编辑:程序博客网 时间:2024/06/05 07:41

因为需要,在嵌入式环境下提供nfs服务,下了nfs-util和portmap,编译通过后,运行都没问题,但是在使用exportfs发布共享目录时,发现在nfs,cpio,jffs2文件系统下都报不支持export操作

1.  跟踪内核源码,在fs/nfsd/export.ccheck_export函数中有如下的代码:

       /* There are two requirements on a filesystem to be exportable.

 * 1:  We must be able to identify the filesystem from a number.

        *       either a device number (so FS_REQUIRES_DEV needed)

        *       or an FSID number (so NFSEXP_FSID or ->uuid is needed).

        * 2:  We must be able to find an inode from a filehandle.

        *       This means that s_export_op must be set.

        */

       if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) &&

           !(flags & NFSEXP_FSID) &&

           uuid == NULL) {

              dprintk("exp_export: export of non-dev fs without fsid/n");

              return -EINVAL;

       }

 

       if (!inode->i_sb->s_export_op ||

           !inode->i_sb->s_export_op->fh_to_dentry) {

              dprintk("exp_export: export of invalid fs type./n");

              return -EINVAL;

       }

可以看到文件系统要被export必须满足两个条件:第一要有唯一标识,可以是fsiduuid或者是设备号,第二是文件系统必须设置了export操作export_operations。第一个条件可以通过在/etc/exports文件中指定fsid的值来满足,第二个条件只有通过查找源代码来分析。在fs/nfs/super.cfs/jffs2/super.c中都未定义export_operations,而在fs/ext3fs/ext4中都进行了定义,所以ext3文件系统可以被正确export,而jffs2nfs都会报错。

原创粉丝点击