Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Debian Lenny] zfs: Unknown symbol lookup_bdev #1205

Closed
nedbass opened this issue Jan 15, 2013 · 11 comments
Closed

[Debian Lenny] zfs: Unknown symbol lookup_bdev #1205

nedbass opened this issue Jan 15, 2013 · 11 comments
Labels
Type: Building Indicates an issue related to building binaries
Milestone

Comments

@nedbass
Copy link
Contributor

nedbass commented Jan 15, 2013

On Debian Lenny, Linux 2.6.26, the lookup_bdev symbol can not be resolved. I don't understand why; it's definitely available in the kernel.

  Building modules, stage 2.
  MODPOST 6 modules
WARNING: "lookup_bdev" [/tmp/zfs-build-buildbot-TkMdcVKF/BUILD/zfs-0.6.0/module/zfs/zfs.ko] undefined!
buildbot@debian-lenny-amd64:~/zfs$ uname -a
Linux debian-lenny-amd64 2.6.26-2-amd64 #1 SMP Sun Mar 4 21:48:06 UTC 2012 x86_64 GNU/Linux
buildbot@debian-lenny-amd64:~/zfs$ sudo ./scripts/zfs.sh
buildbot@debian-lenny-amd64:~/zfs$ dmesg | tail
[ 5413.690341] SPL: Loaded module v0.6.0-rc13
[ 5413.697977] SPLAT: Loaded module v0.6.0-rc13
[ 5413.726905] zfs: Unknown symbol lookup_bdev
buildbot@debian-lenny-amd64:~/zfs$ grep lookup_bdev /proc/kallsyms
ffffffff802bfb0b T lookup_bdev

Introduced by commit 6c28567

@lundman
Copy link
Contributor

lundman commented Jan 15, 2013

Dang, I would guess I am guilty here. As you point out, it is from #1131 . Although, when we checked lookup_bdev was available in 2.6.

@behlendorf
Copy link
Contributor

The problem is that while the function exists all the way back to at least 2.6.12. It wasn't until 2.6.27 that the function was made available to modules by adding the EXPORT_SYMBOL() call. I didn't notice this either when initially landing the patch and apparently nobody else did either for the last month. That probably says something about how many Debian Lenny users are left out there. It seems to me we have 2 options.

  • Drop support for Debian Lenny and 2.6.26 kernels. Lenny is no longer receiving any updates and is officially no longer supported so this should impact very few (if any) users. This old kernel has always been a problem for compatibility so this will simplify our life going forward.
  • Add yet another autoconf check to detect if lookup_bdev is available and handle the case in 6c28567

@nedbass
Copy link
Contributor Author

nedbass commented Jan 15, 2013

For the record, I don't care about Lenny :). I just happened to find this during testing, so I'm fine with dropping support.

@ryao
Copy link
Contributor

ryao commented Jan 15, 2013

It would better to revert 6c28567 in favor of making vdev_uses_zvols return true unconditionally. The original patch made things work when a raw zvol is being used for ZFS, but if you put something between the zvol and ZFS, such as LVM, the original deadlock will still occur.

@behlendorf
Copy link
Contributor

@ryao Until someone comes up with a legitimate use case for the following layering I'm inclined not to spend time worrying about it. However, we could add the autoconf check to detect the missing symbol and just return true unconditionally since that would be safe.

vdev
md | dm | loop | etc
zvol
zpool

@maxximino
Copy link
Contributor

@behlendorf a legitimate use case could be DRBD?

@ryao
Copy link
Contributor

ryao commented Jan 15, 2013

@behlendorf There are virtual machines using ZFS on dm-crypt/luks:

https://mthode.org/posts/2012/Dec/gentoo-hardened-zfs-rootfs-with-dm-cryptluks-updated-2012-12-12/

If something goes wrong in one of them, it would be useful to be able to import the pool on the host to do repairs. It is not possible to do that with the current code.

The same reasoning applies to doing the installation on the host, which is also not possible with the current code.

@ryao
Copy link
Contributor

ryao commented Jan 15, 2013

I just had an idea for an alternative way of handling this. We could check for the whole_disk flag. If whole_disk is 1 on all child vdevs and the immediate block device is not a zvol, then it is safe to do the parallel import. Otherwise, it is not. In addition, if there is only 1 vdev, it makes no sense to do the parallel import, so it can be avoided.

I will take some time to write a patch based on this idea later today. It should handle all cases of interest gracefully.

@ryao
Copy link
Contributor

ryao commented Jan 15, 2013

I probably should add that I have already taken the liberty of writing an autotools check for lookup_bdev in ryao/spl@2e24d25.

@behlendorf
Copy link
Contributor

@ryao Thanks for the 2.6.26 compatibility code, I can get it reviewed and merged to solve the immediate issue. Also the VM use case does seem like a legitimate reason to fix this. I like your idea about avoiding use the taskqs when children == 1 and there's clearly no benefit in doing it in parallel. However, I'm not sure I follow your wholedisk logic. Can you propose a patch with a nice explanation.

@behlendorf
Copy link
Contributor

We can revisit doing something clever in the future as an optimization. For now I've just resolved the build issue for 2.6.26 kernels which probably nobody noticed but Ned and I.

2b7ab9d Linux 2.6.26 compat, lookup_bdev()

unya pushed a commit to unya/zfs that referenced this issue Dec 13, 2013
It's doubtful many people were impacted by this but commit 6c28567
accidentally broke ZFS builds for 2.6.26 and earlier kernels.  This
commit depends on the lookup_bdev() function which exists in 2.6.26
but wasn't exported until 2.6.27.

The availability of the function isn't critical so a wrapper is
introduced which returns ERR_PTR(-ENOTSUP) when the function isn't
defined.  This will have the effect of causing zvol_is_zvol() to
always fail for 2.6.26 kernels.  This in turn means vdevs will
always get opened concurrently which is good for normal usage.
This will only become an issue if your using a zvol as a vdev in
another pool.  In which case you really should be using a newer
kernel anyway.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

No branches or pull requests

5 participants