diff options
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index a314d42c0fa..e356e5e7031 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2136,6 +2136,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) atomic_inc(&proc_poll_event); wake_up_interruptible(&proc_poll_wait); + if (S_ISREG(inode->i_mode)) + inode->i_flags |= S_SWAPFILE; error = 0; goto out; bad_swap: @@ -2163,11 +2165,8 @@ out: } if (name) putname(name); - if (inode && S_ISREG(inode->i_mode)) { - if (!error) - inode->i_flags |= S_SWAPFILE; + if (inode && S_ISREG(inode->i_mode)) mutex_unlock(&inode->i_mutex); - } return error; } |