Skip to content

Remove the error causing #include "../fs/mount.h" statement#1

Open
JanLuca wants to merge 1 commit into
sfjro:aufs4.6from
JanLuca:aufs4.6-fix-mount.h
Open

Remove the error causing #include "../fs/mount.h" statement#1
JanLuca wants to merge 1 commit into
sfjro:aufs4.6from
JanLuca:aufs4.6-fix-mount.h

Conversation

@JanLuca

@JanLuca JanLuca commented Jul 25, 2016

Copy link
Copy Markdown

The include seems not to be necessary and causes problems when
compiling the module not in kernel source tree.

The include seems not to be necessary and causes problems when
compiling the module not in kernel source tree.
@JanLuca

JanLuca commented Jul 25, 2016

Copy link
Copy Markdown
Author

This pull request is the same as the one in #2 but only for branch "aufs4.6"

@sfjro

sfjro commented Jul 26, 2016

Copy link
Copy Markdown
Owner

Hello JanLuca,

JanLuca:

The include seems not to be necessary and causes problems when
compiling the module not in kernel source tree.
:::

  • Remove the error causing #include "../fs/mount.h" statement

It is necessary when you enable CONFIG_AUFS_BR_FUSE.

J. R. Okajima

sfjro added a commit that referenced this pull request Aug 14, 2016
The plain i_mutex lock under si_rwsem acquired may cause a lockdep
message. I've seen it on aufs4.1 for linux-v4.1-rc1, and I am afraid it
is a false positive. The message shows the lockdep chain of
namespace_sem -- si_resem -- i_mutex. Investigating the changes between
v4.0 and v4.1-rc1, I could not find the related commit in it. It may be
related to automount too. I'm afraid it could happen before v4.1-rc1.

======================================================
[ INFO: possible circular locking dependency detected ]
4.1.0aufsD+ #363 Not tainted
-------------------------------------------------------
perf/4110 is trying to acquire lock:
 (namespace_sem){++++++}, at: [<ffffffff811f597e>] lock_mount+0x8e/0x1e0

but task is already holding lock:
 (&sb->s_type->i_mutex_key#2){+.+.+.}, at: [<ffffffff811f5927>] lock_mount+0x37/0x1e0

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (&sb->s_type->i_mutex_key#2){+.+.+.}:
       [<ffffffff810b4248>] lock_acquire+0xc8/0x2a0
       [<ffffffff8179b563>] mutex_lock_nested+0x63/0x510
       [<ffffffff8130f900>] start_creating+0xa0/0x1a0
       [<ffffffff8130fa5d>] debugfs_create_file+0x5d/0x1f0
       [<ffffffffa00dc74c>] dbgaufs_brs_add+0x9c/0x240 [aufs]
       [<ffffffffa00db705>] sysaufs_brs_add+0x25/0x200 [aufs]
       [<ffffffffa009ee7c>] aufs_mount+0x8c/0x1b0 [aufs]
       [<ffffffff811ced88>] mount_fs+0x48/0x260
       [<ffffffff811f434b>] vfs_kern_mount+0x7b/0x190
       [<ffffffff811f6f88>] do_mount+0x228/0xca0
       [<ffffffff811f7e39>] SyS_mount+0xe9/0x110
       [<ffffffff8179fed7>] system_call_fastpath+0x12/0x6f

-> #1 (&sbinfo->si_rwsem){++++++}:
       [<ffffffff810b4248>] lock_acquire+0xc8/0x2a0
       [<ffffffff8179d4d7>] down_read+0x47/0x60
       [<ffffffffa009efe7>] aufs_show_options+0x47/0x7e0 [aufs]
       [<ffffffff8121b670>] show_vfsmnt+0x110/0x160
       [<ffffffff811f2b56>] m_show+0x16/0x20
       [<ffffffff811f9c61>] seq_read+0x3b1/0x4a0
       [<ffffffff811c9fb8>] __vfs_read+0x18/0x40
       [<ffffffff811cb392>] vfs_read+0x122/0x190
       [<ffffffff811cb452>] SyS_read+0x52/0xb0
       [<ffffffff8179fed7>] system_call_fastpath+0x12/0x6f

-> #0 (namespace_sem){++++++}:
       [<ffffffff810b349b>] __lock_acquire+0x181b/0x1e30
       [<ffffffff810b4248>] lock_acquire+0xc8/0x2a0
       [<ffffffff8179d454>] down_write+0x44/0x80
       [<ffffffff811f597e>] lock_mount+0x8e/0x1e0
       [<ffffffff811f6012>] do_add_mount+0x32/0x130
       [<ffffffff811f6afc>] finish_automount+0x6c/0xe0
       [<ffffffff811d78f6>] follow_managed+0x1c6/0x320
       [<ffffffff811d987f>] lookup_fast+0x4ff/0x560
       [<ffffffff811dbf37>] path_lookupat+0xc7/0x8a0
       [<ffffffff811dc745>] filename_lookup+0x35/0x170
       [<ffffffff811dfd46>] user_path_at_empty+0x96/0xe0
       [<ffffffff811dfda1>] user_path_at+0x11/0x20
       [<ffffffff8120c034>] user_statfs+0x34/0x90
       [<ffffffff8120c10b>] SYSC_statfs+0x1b/0x40
       [<ffffffff8120c24e>] SyS_statfs+0xe/0x10
       [<ffffffff8179fed7>] system_call_fastpath+0x12/0x6f

other info that might help us debug this:

Chain exists of:
  namespace_sem --> &sbinfo->si_rwsem --> &sb->s_type->i_mutex_key#2

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#2);
                               lock(&sbinfo->si_rwsem);
                               lock(&sb->s_type->i_mutex_key#2);
  lock(namespace_sem);

 *** DEADLOCK ***

1 lock held by perf/4110:
 #0:  (&sb->s_type->i_mutex_key#2){+.+.+.}, at: [<ffffffff811f5927>] lock_mount+0x37/0x1e0

stack backtrace:
CPU: 0 PID: 4110 Comm: perf Not tainted 4.1.0aufsD+ #363
Hardware name: Pegatron Pegatron/IPM41, BIOS 0001 02/05/2009
 ffffffff85f22880 ffff880021e93908 ffffffff81793ee6 0000000000000000
 ffffffff85eed2a0 ffff880021e93958 ffffffff8178fece ffff880021e93958
 ffff880021e939c8 ffff880021e8e510 ffff880021e8ec58 ffff880021e8e510
Call Trace:
 [<ffffffff81793ee6>] dump_stack+0x4f/0xa2
 [<ffffffff8178fece>] print_circular_bug+0x1fb/0x20c
 [<ffffffff810b349b>] __lock_acquire+0x181b/0x1e30
 [<ffffffff810b4248>] lock_acquire+0xc8/0x2a0
 [<ffffffff811f597e>] ? lock_mount+0x8e/0x1e0
 [<ffffffff8179d454>] down_write+0x44/0x80
 [<ffffffff811f597e>] ? lock_mount+0x8e/0x1e0
 [<ffffffff811f597e>] lock_mount+0x8e/0x1e0
 [<ffffffff811f6012>] do_add_mount+0x32/0x130
 [<ffffffff813b7708>] ? find_next_bit+0x18/0x20
 [<ffffffff811f6afc>] finish_automount+0x6c/0xe0
 [<ffffffff811d78f6>] follow_managed+0x1c6/0x320
 [<ffffffff811d987f>] lookup_fast+0x4ff/0x560
 [<ffffffff811da64f>] ? path_init+0xbf/0x8d0
 [<ffffffff811dbe00>] ? complete_walk+0x1e0/0x250
 [<ffffffff811dbf37>] path_lookupat+0xc7/0x8a0
 [<ffffffff811dc745>] filename_lookup+0x35/0x170
 [<ffffffff811dfd46>] user_path_at_empty+0x96/0xe0
 [<ffffffff8118dce8>] ? might_fault+0xa8/0xb0
 [<ffffffff8118dc9f>] ? might_fault+0x5f/0xb0
 [<ffffffff8120bf27>] ? do_statfs_native+0xa7/0xc0
 [<ffffffff811dfda1>] user_path_at+0x11/0x20
 [<ffffffff8120c034>] user_statfs+0x34/0x90
 [<ffffffff8120c10b>] SYSC_statfs+0x1b/0x40
 [<ffffffff813ae808>] ? lockdep_sys_exit_thunk+0x12/0x14
 [<ffffffff8120c24e>] SyS_statfs+0xe/0x10
 [<ffffffff8179fed7>] system_call_fastpath+0x12/0x6f

Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
(cherry picked from commit f440be7d4ac14d1ae004adaee072114fd31e8d83)
@JanLuca

JanLuca commented Aug 18, 2016

Copy link
Copy Markdown
Author

Sorry for the response delay.

The problem is that the include causes a build error when you try to build the module out-of-kernel-tree. I am packaging the aufs4 module for Debian at the moment and I have to remove this include statement to build the code successfully. Maybe you can add a #if-statement around the code to avoid this problem.

@sfjro

sfjro commented Aug 19, 2016

Copy link
Copy Markdown
Owner

Jan Luca Naumann:

Sorry for the response delay.

The problem is that the include causes a build error when you try to build the module out-of-kernel-tree. I am packaging the aufs4 module for Debian at the moment and I have to remove this include statement to build the code successfully. Maybe you can add a #if-statement around the code to avoid this problem.

Adding #if is possible.
But I'd like to confirm the problem before adding.
How are you compiling aufs, method 1 or 2 (in README file)?
If I add one small note about the include path, is it acceptable for
you?

J. R. Okajima

@JanLuca

JanLuca commented Aug 19, 2016

Copy link
Copy Markdown
Author

I use method 2 to build the module and there is no "../fs/mount.h" that can be included in vfsub.c.

@sfjro

sfjro commented Aug 19, 2016

Copy link
Copy Markdown
Owner

Jan Luca Naumann:

I use method 2 to build the module and there is no "../fs/mount.h" that can be included in vfsub.c.

So you didn't specify nor change KDIR make variable, right?
Then KDIR must be "/lib/modules/$(shell uname -r)/build" as described in
Makefile. Does your system have "source" dir or symlink under the same
"/lib/modules/$(shell uname -r)" too?
If I add something like
EXTRA_CFLAGS += -DKSOURCE=/lib/modules/$(shell uname -r)/source
and modify the include line like
#include KSOURCE ## "fs/mount.h"
then your compilation succeeds?

J. R. Okajima

sfjro added a commit that referenced this pull request Aug 22, 2016
This commit is very similar to
	a1e4589 2016-08-13 aufs: possible bugfix, temporary lockdep_off
				for debugfs_create_file
but the trigger is debugfs_remove instead of debugfs_create_file.

======================================================
[ INFO: possible circular locking dependency detected ]
4.6.0aufsD+ #370 Not tainted
-------------------------------------------------------
mount/11486 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#2){+.+.+.}, at: [<ffffffff813720d9>] debugfs_remove+0x79/0xc0

but task is already holding lock:
 (&iinfo->ii_rwsem#2){+++++.}, at: [<ffffffffa00b9530>] do_ii_write_lock+0x170/0x190 [aufs]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #3 (&iinfo->ii_rwsem#2){+++++.}:
       [<ffffffff810bf72e>] lock_acquire+0xbe/0x220
       [<ffffffff810b96d2>] down_read_nested+0x52/0x70
       [<ffffffffa00cdbbb>] aufs_permission+0x9b/0x760 [aufs]
       [<ffffffff811f7550>] __inode_permission+0xb0/0x140
       [<ffffffff811f765a>] inode_permission+0x7a/0xa0
       [<ffffffff811e780a>] SyS_access+0xda/0x220
       [<ffffffff8182a725>] entry_SYSCALL_64_fastpath+0x18/0xa8

-> #2 (&sbinfo->si_rwsem){++++++}:
       [<ffffffff810bf72e>] lock_acquire+0xbe/0x220
       [<ffffffff818282e7>] down_read+0x47/0x60
       [<ffffffffa00a1797>] aufs_show_options+0x47/0x770 [aufs]
       [<ffffffff8123b0fc>] show_vfsmnt+0x10c/0x150
       [<ffffffff812120b7>] m_show+0x17/0x20
       [<ffffffff81218dd8>] seq_read+0x398/0x490
       [<ffffffff811e9378>] __vfs_read+0x18/0x40
       [<ffffffff811eb0e3>] vfs_read+0x143/0x1b0
       [<ffffffff811eb1a2>] SyS_read+0x52/0xa0
       [<ffffffff8182a725>] entry_SYSCALL_64_fastpath+0x18/0xa8

-> #1 (namespace_sem){++++++}:
       [<ffffffff810bf72e>] lock_acquire+0xbe/0x220
       [<ffffffff81828264>] down_write+0x44/0x80
       [<ffffffff81214ece>] lock_mount+0x8e/0x1e0
       [<ffffffff81215522>] do_add_mount+0x32/0x130
       [<ffffffff81215f7c>] finish_automount+0x6c/0xe0
       [<ffffffff811f6f3a>] follow_managed+0x1aa/0x350
       [<ffffffff811f87f2>] lookup_fast+0x3f2/0x530
       [<ffffffff811f9557>] walk_component+0x87/0x360
       [<ffffffff811faaf0>] path_lookupat+0x70/0x150
       [<ffffffff811fd9e5>] filename_lookup.part.43+0xd5/0x230
       [<ffffffff811fdba8>] filename_lookup+0x68/0x80
       [<ffffffff811fdfb1>] user_path_at_empty+0x41/0x50
       [<ffffffff8122b017>] user_statfs+0x37/0x90
       [<ffffffff8122b0db>] SYSC_statfs+0x1b/0x40
       [<ffffffff8122b20e>] SyS_statfs+0xe/0x10
       [<ffffffff8182a725>] entry_SYSCALL_64_fastpath+0x18/0xa8

-> #0 (&sb->s_type->i_mutex_key#2){+.+.+.}:
       [<ffffffff810beb48>] __lock_acquire+0x1738/0x1dc0
       [<ffffffff810bf72e>] lock_acquire+0xbe/0x220
       [<ffffffff8182580e>] mutex_lock_nested+0x6e/0x500
       [<ffffffff813720d9>] debugfs_remove+0x79/0xc0
       [<ffffffffa00dd2f2>] dbgaufs_brs_del+0xe2/0x100 [aufs]
       [<ffffffffa00dc27f>] sysaufs_brs_del+0x2f/0x140 [aufs]
       [<ffffffffa00a4b27>] au_br_add+0x997/0xd00 [aufs]
       [<ffffffffa00abd27>] au_opt_br.isra.14+0x57/0x120 [aufs]
       [<ffffffffa00af044>] au_opts_remount+0xb4/0x290 [aufs]
       [<ffffffffa00a3762>] aufs_remount_fs+0x252/0x300 [aufs]
       [<ffffffff811ee3e1>] do_remount_sb+0x71/0x1c0
       [<ffffffff81216b11>] do_mount+0x941/0xea0
       [<ffffffff8121747a>] SyS_mount+0x10a/0x120
       [<ffffffff8182a725>] entry_SYSCALL_64_fastpath+0x18/0xa8

other info that might help us debug this:

Chain exists of:
  &sb->s_type->i_mutex_key#2 --> &sbinfo->si_rwsem --> &iinfo->ii_rwsem#2

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&iinfo->ii_rwsem#2);
                               lock(&sbinfo->si_rwsem);
                               lock(&iinfo->ii_rwsem#2);
  lock(&sb->s_type->i_mutex_key#2);

 *** DEADLOCK ***

5 locks held by mount/11486:
 #0:  (&type->s_umount_key#57){+.+.+.}, at: [<ffffffff812165a9>] do_mount+0x3d9/0xea0
 #1:  (&type->i_mutex_dir_key#7){+.+.+.}, at: [<ffffffffa00a3713>] aufs_remount_fs+0x203/0x300 [aufs]
 #2:  (&sbinfo->si_rwsem){++++++}, at: [<ffffffffa009fd62>] si_write_lock+0x42/0x1e0 [aufs]
 #3:  (&dinfo->di_rwsem){+++++.}, at: [<ffffffffa00b9fbf>] di_write_lock+0x2f/0x60 [aufs]
 #4:  (&iinfo->ii_rwsem#2){+++++.}, at: [<ffffffffa00b9530>] do_ii_write_lock+0x170/0x190 [aufs]

stack backtrace:
CPU: 0 PID: 11486 Comm: mount Not tainted 4.6.0aufsD+ #370
Hardware name: Pegatron Pegatron/IPM41, BIOS 0001 02/05/2009
 0000000000000000 ffff88002b793908 ffffffff814084e7 ffffffff86111170
 ffffffff86178580 ffff88002b793958 ffffffff8116b125 ffff88002b793948
 ffff88002b7939e8 ffff88002d543108 ffff88002d542940 ffff88002d543108
Call Trace:
 [<ffffffff814084e7>] dump_stack+0x67/0x90
 [<ffffffff8116b125>] print_circular_bug+0x202/0x213
 [<ffffffff810beb48>] __lock_acquire+0x1738/0x1dc0
 [<ffffffff81827e3e>] ? mutex_unlock+0xe/0x10
 [<ffffffff810bf72e>] lock_acquire+0xbe/0x220
 [<ffffffff813720d9>] ? debugfs_remove+0x79/0xc0
 [<ffffffff813720d9>] ? debugfs_remove+0x79/0xc0
 [<ffffffff813720d9>] ? debugfs_remove+0x79/0xc0
 [<ffffffff8182580e>] mutex_lock_nested+0x6e/0x500
 [<ffffffff813720d9>] ? debugfs_remove+0x79/0xc0
 [<ffffffff81418ff1>] ? lockref_get+0x11/0x30
 [<ffffffff813720d9>] debugfs_remove+0x79/0xc0
 [<ffffffffa00dd2f2>] dbgaufs_brs_del+0xe2/0x100 [aufs]
 [<ffffffffa00dc27f>] sysaufs_brs_del+0x2f/0x140 [aufs]
 [<ffffffffa00a4b27>] au_br_add+0x997/0xd00 [aufs]
 [<ffffffffa00abd27>] au_opt_br.isra.14+0x57/0x120 [aufs]
 [<ffffffffa00af044>] au_opts_remount+0xb4/0x290 [aufs]
 [<ffffffffa00b9530>] ? do_ii_write_lock+0x170/0x190 [aufs]
 [<ffffffffa00a3762>] aufs_remount_fs+0x252/0x300 [aufs]
 [<ffffffff811ee3e1>] do_remount_sb+0x71/0x1c0
 [<ffffffff81216b11>] do_mount+0x941/0xea0
 [<ffffffff812160ed>] ? copy_mount_options+0xfd/0x1c0
 [<ffffffff812160d9>] ? copy_mount_options+0xe9/0x1c0
 [<ffffffff8121747a>] SyS_mount+0x10a/0x120
 [<ffffffff8182a725>] entry_SYSCALL_64_fastpath+0x18/0xa8

(cherry picked from commit 3148d7ee2d491f9db12393f4b3102c36acce80a6)
@JanLuca

JanLuca commented Aug 22, 2016

Copy link
Copy Markdown
Author

I use DKMS to build the module. I do not change KDIR and the modules builds without problems if I remove the include. DKMS has a variable "$kernel_source_dir" that could be passed to the Makefile as e.g. KDIR, anyway.

If you can add a way so the include can be found, even if the module is built out-of-tree, this would be nice :-)

@JanLuca

JanLuca commented Aug 22, 2016

Copy link
Copy Markdown
Author

Btw, you can find the DKMS file I use for building here: https://github.com/JanLuca/aufs4-debian/blob/master/debian/aufs4-dkms.dkms

@sfjro

sfjro commented Aug 22, 2016

Copy link
Copy Markdown
Owner

Jan Luca Naumann:

Btw, you can find the DKMS file I use for building here: https://github.com/JanLuca/aufs4-debian/blob/master/debian/aufs4-dkms.dkms

Then I'd ask again.
Do you have "${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/source" dir
or symlink on your system?

J. R. Okajima

@JanLuca

JanLuca commented Aug 25, 2016

Copy link
Copy Markdown
Author

I have "/lib/modules/$(shell uname -r)/source" as kernel source dir on my machine. The KDIR variable in the Makefile is OK as it is.

@sfjro

sfjro commented Aug 26, 2016

Copy link
Copy Markdown
Owner

Jan Luca Naumann:

I have "/lib/modules/$(shell uname -r)/source" as kernel source dir on my machine. The KDIR variable in the Makefile is OK as it is.

I am confused now.
I've tried aufs4-standalone.git#aufs4.3, and succeeded.
Building with V=1, linux build system prints verbose commands. While I
don't know how your DKMS handles Makefiles, here is the output on my
test system from the ordinary make command.

~$ mkdir /tmp/w
$ cd /tmp/w
/tmp/w$ git clonem -q git://github.com/sfjro/aufs4-standalone.git .
/tmp/w#master$ git co aufs4.3
/tmp/w#aufs4.3$ uname -a
Linux jrofr 3.18.0aufsD+ #418 SMP PREEMPT Wed Aug 24 16:13:38 JST 2016 x86_64 GNU/Linux
/tmp/w#aufs4.3$ make V=1 KDIR=
/aufs/aufs4-linux/D aufs.ko
:::
make -C ~/aufs/aufs4-linux/D M=/tmp/w/fs/aufs EXTRA_CFLAGS= ...
make[1]: Entering directory '/home/jro/aufs/aufs4-linux/D'
make -C /proj/aufs/aufs4-linux.git O=/home/jro/aufs/aufs4-linux/D/. modules
make -C /home/jro/aufs/aufs4-linux/D KBUILD_SRC=/proj/aufs/aufs4-linux.git
-f /proj/aufs/aufs4-linux.git/Makefile modules
:::
make -f /proj/aufs/aufs4-linux.git/scripts/Makefile.build obj=/tmp/w/fs/aufs
:::
gcc -Wp,-MD,/tmp/w/fs/aufs/.vfsub.o.d ..."various include paths"... /tmp/w/fs/aufs/vfsub.c

Notice these points.

  • the running system is linux-v3.18
  • building aufs4-standalone.git#aufs4.3
  • v4.3 kernel source files are under /proj/aufs/aufs4-linux.git
  • v4.3 kernel build dir is ~/aufs/aufs4-linux-D, which I spedified as
    KDIR
  • aufs Makefile and the kernel Makefiles invoke the nested make command
  • those Makefiles add the include paths.

Finally fs/aufs/vfsub.c is compiled successfully.
On my system, -I/proj/aufs/aufs4-linux.git/include is added, and
#include "../fs/mount.h" is interpreted as
/proj/aufs/aufs4-linux.git/include/../fs/mount.h which exists.

I'd suggest you to try "make" instead of "dkms" and see the difference
of the added include paths.

J. R. Okajima

@JanLuca

JanLuca commented Aug 31, 2016

Copy link
Copy Markdown
Author

So I had some time today to debug the problem a little bit more in detail:

The problem is that the header file "fs/mount.h" seems not to be part of the (public) header file generated by the kernel Makefile (only linux/mount.h is exported). Thus it is not included in e.g. the header package of Debian which is used to build e.g. DKMS modules. How important is it to include the header file?

(For completeness the gcc-line when the compilation failed:

gcc-5 -Wp,-MD,/var/lib/dkms/aufs4/4.7+20160822/build/fs/aufs/.vfsub.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/src/linux-headers-4.7.0-1-common/arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -I/usr/src/linux-headers-4.7.0-1-common/include -Iinclude -I/usr/src/linux-headers-4.7.0-1-common/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/usr/src/linux-headers-4.7.0-1-common/include/uapi -Iinclude/generated/uapi -include /usr/src/linux-headers-4.7.0-1-common/include/linux/kconfig.h -I/var/lib/dkms/aufs4/4.7+20160822/build/fs/aufs -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-var-tracking-assignments -g -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -DCC_HAVE_ASM_GOTO -DFUSE_SUPER_MAGIC=0x65735546 -DXFS_SB_MAGIC=0x58465342 -DCONFIGFS_MAGIC=0x62656570 -DUBIFS_SUPER_MAGIC=0x24051905 -DHFSPLUS_SUPER_MAGIC=0x482b -DDEBUG -include /var/lib/dkms/aufs4/4.7+20160822/build/fs/aufs/../../include/uapi/linux/aufs_type.h -I/var/lib/dkms/aufs4/4.7+20160822/build/include -DCONFIG_AUFS_FS_MODULE -UCONFIG_AUFS -DCONFIG_AUFS_BRANCH_MAX_127 -DCONFIG_AUFS_SBILIST -DCONFIG_AUFS_DEBUG -DMODULE -DKBUILD_BASENAME='"vfsub"' -DKBUILD_MODNAME='"aufs"' -c -o /var/lib/dkms/aufs4/4.7+20160822/build/fs/aufs/.tmp_vfsub.o /var/lib/dkms/aufs4/4.7+20160822/build/fs/aufs/vfsub.c

/var/lib/dkms/aufs4/4.7+20160822/build/fs/aufs/vfsub.c:26:25: fatal error: ../fs/mount.h: No such file or directory

)

@sfjro

sfjro commented Sep 5, 2016

Copy link
Copy Markdown
Owner

Jan Luca Naumann:

So I had some time today to debug the problem a little bit more in detail:

The problem is that the header file "fs/mount.h" seems not to be part of th=
e (public) header file generated by the kernel Makefile (only linux/mount.h=
is exported). Thus it is not included in e.g. the header package of Debian=
which is used to build e.g. DKMS modules. How important is it to include t=
he header file?

Without fs/mount.h, some features won't be compiled such as exporting
via NFS and FUSE branch. How important? It is totally depending upon
users configuration.
For your case, it might be a solution to move the #inlucde line into
#ifdef CONFIG_AUFS_BR_FUSE region in fs/aufs/vfsub.c. But, if, only if,
someday you enable CONFIG_AUFS_EXPORT, you will meet the exact same
problem again. I don't think it a good idea.

I understand that your build system DKMS (which I have never tried)
doesn't refer to the kernel source files. Instead, it gives you a
prepared (public) header files. As aufs README file says, the kernel
source tree is essentially necessary to build aufs.
How about adding
EXTRA_CFLAGS="-I/your/aufs4-standalone.git/include -I/your/kernel/source/tree/include"
into your
MAKE[0]="make -C ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build aufs.ko";
line?

J. R. Okajima

@sfjro

sfjro commented Nov 21, 2016

Copy link
Copy Markdown
Owner

------- Blind-Carbon-Copy

From: sfjro@users.sourceforge.net
Subject: Re: [Filesystems-devel] Bug#843846: aufs for 4.8: "../fs/mount.h not found" when enabling NFS export
To: Philipp Marek philipp.marek@linbit.com
Cc: Jan Luca Naumann j.naumann@fu-berlin.de, 843846@bugs.debian.org
In-Reply-To: 20161110135240.osvpazz34u3ahnon@cacao.linbit
References: 20161110082627.xewfc2sr3x4p4b5s@cacao.linbit 1320BA39-FA66-4C22-AF22-9A789F270665@fu-berlin.de 20161110085649.jzios36sh3pntgh4@cacao.linbit 3B61DDA1-C07A-4411-A41A-4A3C0209544F@fu-berlin.de 20161110135240.osvpazz34u3ahnon@cacao.linbit
Date: Tue, 22 Nov 2016 01:00:30 +0900
Message-ID: 31029.1479744030@jrobl

Philipp Marek:

But fs/mount.h does

#include <linux/mount.h>

and it seems that the linux/mount.h contains everything that AUFS needs.

I've got the module up and running for a few hours, mounting/unmounting
directories all the time (in a testsuite)... so it looks as if it's not
completely broken ;)

Sorry for the long delay.
This "aufs is compiled and working" news surprised me, and I digged down
the git log to find out why fs/mount.h is necessary.
And here is the fix which will be included in next aufs release.

Thanx for reporting, two of you.
J. R. Okajima

commit 348da45314afe6fc88e6f91a74da4587ec6555af
Author: J. R. Okajima hooanon05g@gmail.com
Date: Tue Nov 22 00:51:45 2016 +0900

aufs: dependency bugfix, linux/fs/mount.h

linux/fs/mount.h is included from two aufs source files,
fs/aufs/export.c and fs/aufs/vfsub.c.
For export.c, it is unnecessary which means a build dependency bug. The
bug was born back in 2012.
    c70a5cf 2012-01-13 aufs: tiny for 3.3, arg for iterate_mounts()
For vfsub.c, it is necessary and it is not a bug. But it is just for
CONFIG_AUFS_BR_FUSE only. So it should be refined by "#ifdef
CONFIG_AUFS_BR_FUSE".

Reported-by: Jan Luca Naumann <j.naumann@fu-berlin.de>
See-also: https://github.com/sfjro/aufs4-standalone/pull/1
Reported-by: Philipp Marek <philipp.marek@linbit.com>
See-also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843846
Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>

diff --git a/fs/aufs/export.c b/fs/aufs/export.c
index 2b2380a..afba472 100644

  • --- a/fs/aufs/export.c
    +++ b/fs/aufs/export.c
    @@ -12,7 +12,6 @@
    #include <linux/nsproxy.h>
    #include <linux/random.h>
    #include <linux/writeback.h>

  • -#include "../fs/mount.h"
    #include "aufs.h"

    union conv {
    diff --git a/fs/aufs/vfsub.c b/fs/aufs/vfsub.c
    index f2d1b36..fc52351 100644

  • --- a/fs/aufs/vfsub.c
    +++ b/fs/aufs/vfsub.c
    @@ -10,7 +10,9 @@
    #include <linux/nsproxy.h>
    #include <linux/security.h>
    #include <linux/splice.h>
    +#ifdef CONFIG_AUFS_BR_FUSE
    #include "../fs/mount.h"
    +#endif
    #include "aufs.h"

    #ifdef CONFIG_AUFS_BR_FUSE

------- End of Blind-Carbon-Copy

sfjro added a commit to sfjro/aufs4-linux that referenced this pull request Dec 17, 2016
linux/fs/mount.h is included from two aufs source files,
fs/aufs/export.c and fs/aufs/vfsub.c.
For export.c, it is unnecessary which means a build dependency bug. The
bug was born back in 2012.
	c70a5cf 2012-01-13 aufs: tiny for 3.3, arg for iterate_mounts()
For vfsub.c, it is necessary and it is not a bug. But it is just for
CONFIG_AUFS_BR_FUSE only. So it should be refined by "#ifdef
CONFIG_AUFS_BR_FUSE".

Reported-by: Jan Luca Naumann <j.naumann@fu-berlin.de>
See-also: sfjro/aufs4-standalone#1
Reported-by: Philipp Marek <philipp.marek@linbit.com>
See-also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843846
Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants