]> git.baikalelectronics.ru Git - kernel.git/commit
ovl: use ovl_inode_lock in ovl_llseek()
authorAmir Goldstein <amir73il@gmail.com>
Sat, 21 Dec 2019 09:42:29 +0000 (11:42 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 22 Jan 2020 19:11:41 +0000 (20:11 +0100)
commitcd455e3fdcef82414a639257c0d612d98aced652
treefaabb4d4dd5af7b3ea8448d1db1ed1019965fc5a
parent3094f70af8d4598c62b342967a0795d2d82dc760
ovl: use ovl_inode_lock in ovl_llseek()

In ovl_llseek() we use the overlay inode rwsem to protect against
concurrent modifications to real file f_pos, because we copy the overlay
file f_pos to/from the real file f_pos.

This caused a lockdep warning of locking order violation when the
ovl_llseek() operation was called on a lower nested overlay layer while the
upper layer fs sb_writers is held (with patch improving copy-up efficiency
for big sparse file).

Use the internal ovl_inode_lock() instead of the overlay inode rwsem in
those cases. It is meant to be used for protecting against concurrent
changes to overlay inode internal state changes.

The locking order rules are documented to explain this case.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/file.c
fs/overlayfs/inode.c