Skip to content

Commit

Permalink
aufs: call mutex.owner only when DEBUG_MUTEXES or MUTEX_SPIN_ON_OWNER…
Browse files Browse the repository at this point in the history
… is defined

'owner' member of 'struct mutex' is defined as below
in 'include/linux/mutex.h':

struct mutex {
...
if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
        struct task_struct      *owner;
endif
...

But function au_pin_hdir_set_owner() called owner as below:

 void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task)
 {
if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
        p->hdir->hi_inode->i_mutex.owner = task;
endif
 }

So if Kernel doesn't define 'DEBUG_MUTEXES' and 'MUTEX_SPIN_ON_OWNER',
but defines SMP, compiler will report the below error:

fs/aufs/i_op.c: In function 'au_pin_hdir_set_owner':
fs/aufs/i_op.c:593:28: error: 'struct mutex' has no member named 'owner'
  p->hdir->hi_inode->i_mutex.owner = task;
                            ^

Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
  • Loading branch information
Yanjiang Jin authored and RobertCNelson committed Apr 6, 2018
1 parent 02f450b commit c8f540d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/aufs/i_op.c
Expand Up @@ -589,7 +589,7 @@ int au_pin_hdir_relock(struct au_pin *p)

void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task)
{
#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
p->hdir->hi_inode->i_mutex.owner = task;
#endif
}
Expand Down

0 comments on commit c8f540d

Please sign in to comment.