zufs-zuf
zufs-zuf copied to clipboard
Unhandled page fault in zuf_create
Hi Authors,
I managed to build zuf.ko, on my Ubuntu 20 (5.4.0-73-generic) with gcc 9.3.0 For zusd, libzus.so and libtoyfs.so, I had to make the following changes to build:
-
create .config under zus/ which looks like the following: ZUF_KERN_DIR=../zuf DEBUG=0 CONFIG_PEDANTIC = 0 CONFIG_OPTIMIZE_LEVEL = 2 CONFIG_TRY_ANON_MMAP = 0 CONFIG_ZUF_DEF_PATH = /sys/fs/zuf CONFIG_BUILD_VERBOSE = 0 CONFIG_LIBFS_MODULES = toyfs
-
add "no-incompatible-pointer-types" to CWARNS inside common.zus.mk
-
get rid of the 3rd NULL parameter in those _zus_iom_start() invocations inside fs/toyfs/mmap.c as the declaration of that function inside iom_enc.h only takes two params.
I also created a /dev/pmem0 device via DRAM emulation by adding " memmap=16G!4G" to GRUB_CMDLINE_LINUX in grub config.
After that I was able to insmod zuf.ko, mount /sys/fs/zuf, mount /mnt/toyfs. However when I tried to create a file or directory under /mnt/toyfs, I always hit the following fault:
[ 5999.029269] zuf: vfs [zuf_lookup:68] [1] dentry-name=file [ 5999.029352] zuf: error [zuf_lookup:77] zufc_dispatch failed => -2 [ 5999.029365] zuf: vfs [zuf_create:106] [1] dentry-name=file mode=0x81b6 [ 5999.029472] zuf: d-oto [zuf_new_inode:361] inode=00000000a6332c56 name=file [ 5999.029483] zuf: acl [zuf_get_acl:205] [1] type=0x4000 [ 5999.029500] zuf: vfs [__zuf_getxattr:79] [1] type=2 name=posix_acl_default size=4096 ioc_size=66 [ 5999.029779] zuf: error [zuf_new_inode:391] zufc_dispatch failed => -568299520 [ 5999.029792] zuf: error [zuf_evict_inode:277] [0] inode without zi mode=0x8000 size=0x0 [ 5999.029819] BUG: unable to handle page fault for address: ffffffffde207020 [ 5999.038812] #PF: supervisor write access in kernel mode [ 5999.045469] #PF: error_code(0x0002) - not-present page
With some investigation I pinpointed the problem in zuf_new_inode. See below for details:
static int zuf_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { struct inode *inode; zuf_pcpu_inc(SBI(dir->i_sb), zu_pcpu_us_create); zuf_dbg_vfs("[%ld] dentry-name=%s mode=0x%x\n", dir->i_ino, dentry->d_name.name, mode); inode = zuf_new_inode(dir, mode, &dentry->d_name, NULL, 0, false); <= returns a large error code -568299520 if (IS_ERR(inode)) <= IS_ERR fails to detect the error return PTR_ERR(inode); inode->i_op = &zuf_file_inode_operations; <= dereferencing inode->i_op caused an page fault inode->i_mapping->a_ops = &zuf_aops; inode->i_fop = &zuf_file_operations; _instantiate_unlock(dentry, inode); return 0; }
Can anyone help to address my problem?
Hi! I'm not author but I spent some time fixing this. You should update toyfs_new_inode function from fs/toyfs/inode.c module to return int as result and put zii structure to ioc_new like this ioc_new->zus_ii = zii
Please do not hack on toys, it is deprecated. Please use the new pmfs2 which is a driviation of toys, but has proper pmem performance because of the proper structure of the inode's blocks allocation. (btree instead of linklist) Tell me if you can't find it it should be in its own tree, GPL license. . [toyfs was supposed to be removed, but accidently was not, because it was not maintained after pmfs2 was introduced]
On Thu, Oct 27, 2022 at 12:40 AM aepotapov @.***> wrote:
Hi! I'm not author but I spent some time fixing this. You should update toyfs_new_inode function from fs/toyfs/inode.c module to return int as result and put zii structure to ioc_new like this ioc_new->zus_ii = zii
— Reply to this email directly, view it on GitHub https://github.com/NetApp/zufs-zuf/issues/4#issuecomment-1292683299, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIUNOLAFIJASGUQ6JU2QO2LWFGQNFANCNFSM443FDXJA . You are receiving this because you are subscribed to this thread.Message ID: @.***>