diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/inode.c b/fs/inode.c index 3cc504320467..ac8d904b3f16 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1542,9 +1542,11 @@ void touch_atime(struct path *path) | |||
1542 | if (timespec_equal(&inode->i_atime, &now)) | 1542 | if (timespec_equal(&inode->i_atime, &now)) |
1543 | return; | 1543 | return; |
1544 | 1544 | ||
1545 | if (mnt_want_write(mnt)) | 1545 | if (!sb_start_write_trylock(inode->i_sb)) |
1546 | return; | 1546 | return; |
1547 | 1547 | ||
1548 | if (__mnt_want_write(mnt)) | ||
1549 | goto skip_update; | ||
1548 | /* | 1550 | /* |
1549 | * File systems can error out when updating inodes if they need to | 1551 | * File systems can error out when updating inodes if they need to |
1550 | * allocate new space to modify an inode (such is the case for | 1552 | * allocate new space to modify an inode (such is the case for |
@@ -1555,7 +1557,9 @@ void touch_atime(struct path *path) | |||
1555 | * of the fs read only, e.g. subvolumes in Btrfs. | 1557 | * of the fs read only, e.g. subvolumes in Btrfs. |
1556 | */ | 1558 | */ |
1557 | update_time(inode, &now, S_ATIME); | 1559 | update_time(inode, &now, S_ATIME); |
1558 | mnt_drop_write(mnt); | 1560 | __mnt_drop_write(mnt); |
1561 | skip_update: | ||
1562 | sb_end_write(inode->i_sb); | ||
1559 | } | 1563 | } |
1560 | EXPORT_SYMBOL(touch_atime); | 1564 | EXPORT_SYMBOL(touch_atime); |
1561 | 1565 | ||
@@ -1662,11 +1666,11 @@ int file_update_time(struct file *file) | |||
1662 | return 0; | 1666 | return 0; |
1663 | 1667 | ||
1664 | /* Finally allowed to write? Takes lock. */ | 1668 | /* Finally allowed to write? Takes lock. */ |
1665 | if (mnt_want_write_file(file)) | 1669 | if (__mnt_want_write_file(file)) |
1666 | return 0; | 1670 | return 0; |
1667 | 1671 | ||
1668 | ret = update_time(inode, &now, sync_it); | 1672 | ret = update_time(inode, &now, sync_it); |
1669 | mnt_drop_write_file(file); | 1673 | __mnt_drop_write_file(file); |
1670 | 1674 | ||
1671 | return ret; | 1675 | return ret; |
1672 | } | 1676 | } |