On Mon 26-02-18 20:20:11, Dan Williams wrote: > dax_sem_{up,down}_write_sem() allow the ext2 dax semaphore to be compiled > out in the CONFIG_FS_DAX=n case. However there are still some open coded > uses of the semaphore. Add dax_sem_{up_read,down_read,_is_locked}() > helpers and convert all open-coded usages of the semaphore to the > helpers. Just one nit below. With that fixed you can add: Reviewed-by: Jan Kara <jack@xxxxxxx> > Cc: Jan Kara <jack@xxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> > Fixes: dee410792419 ("/dev/dax, core: file operations and dax-mmap") > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> > --- > fs/ext2/ext2.h | 6 ++++++ > fs/ext2/file.c | 5 ++--- > fs/ext2/inode.c | 4 +--- > 3 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h > index 032295e1d386..7ceb29733cdb 100644 > --- a/fs/ext2/ext2.h > +++ b/fs/ext2/ext2.h > @@ -711,9 +711,15 @@ struct ext2_inode_info { > #ifdef CONFIG_FS_DAX > #define dax_sem_down_write(ext2_inode) down_write(&(ext2_inode)->dax_sem) > #define dax_sem_up_write(ext2_inode) up_write(&(ext2_inode)->dax_sem) > +#define dax_sem_is_locked(ext2_inode) rwsem_is_locked(&(ext2_inode)->dax_sem) > +#define dax_sem_down_read(ext2_inode) down_read(&(ext2_inode)->dax_sem) > +#define dax_sem_up_read(ext2_inode) up_read(&(ext2_inode)->dax_sem) > #else > #define dax_sem_down_write(ext2_inode) > #define dax_sem_up_write(ext2_inode) > +#define dax_sem_is_locked(ext2_inode) (true) This is a bit dangerous as depending on the use of dax_sem_is_locked() you'd need this to return true or false. E.g. assume we'd have a place where we'd like to do: WARN_ON(dax_sem_is_locked(inode)); or just if (dax_sem_is_locked(inode)) bail out due to congestion... How I'd solve this is that I'd define: #define assert_dax_sem_locked(ext2_inode) WARN_ON(rwsem_is_locked(&(ext2_inode)->dax_sem) and just as do {} while (0) for !CONFIG_FS_DAX. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR