aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index c72b940797fc..712dfc77793b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1628,6 +1628,12 @@ do_last:
1628 goto exit; 1628 goto exit;
1629 } 1629 }
1630 1630
1631 if (IS_ERR(nd->intent.open.file)) {
1632 mutex_unlock(&dir->d_inode->i_mutex);
1633 error = PTR_ERR(nd->intent.open.file);
1634 goto exit_dput;
1635 }
1636
1631 /* Negative dentry, just create the file */ 1637 /* Negative dentry, just create the file */
1632 if (!path.dentry->d_inode) { 1638 if (!path.dentry->d_inode) {
1633 if (!IS_POSIXACL(dir->d_inode)) 1639 if (!IS_POSIXACL(dir->d_inode))
@@ -2621,16 +2627,27 @@ int __page_symlink(struct inode *inode, const char *symname, int len,
2621 int err = -ENOMEM; 2627 int err = -ENOMEM;
2622 char *kaddr; 2628 char *kaddr;
2623 2629
2630retry:
2624 page = find_or_create_page(mapping, 0, gfp_mask); 2631 page = find_or_create_page(mapping, 0, gfp_mask);
2625 if (!page) 2632 if (!page)
2626 goto fail; 2633 goto fail;
2627 err = mapping->a_ops->prepare_write(NULL, page, 0, len-1); 2634 err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
2635 if (err == AOP_TRUNCATED_PAGE) {
2636 page_cache_release(page);
2637 goto retry;
2638 }
2628 if (err) 2639 if (err)
2629 goto fail_map; 2640 goto fail_map;
2630 kaddr = kmap_atomic(page, KM_USER0); 2641 kaddr = kmap_atomic(page, KM_USER0);
2631 memcpy(kaddr, symname, len-1); 2642 memcpy(kaddr, symname, len-1);
2632 kunmap_atomic(kaddr, KM_USER0); 2643 kunmap_atomic(kaddr, KM_USER0);
2633 mapping->a_ops->commit_write(NULL, page, 0, len-1); 2644 err = mapping->a_ops->commit_write(NULL, page, 0, len-1);
2645 if (err == AOP_TRUNCATED_PAGE) {
2646 page_cache_release(page);
2647 goto retry;
2648 }
2649 if (err)
2650 goto fail_map;
2634 /* 2651 /*
2635 * Notice that we are _not_ going to block here - end of page is 2652 * Notice that we are _not_ going to block here - end of page is
2636 * unmapped, so this will only try to map the rest of page, see 2653 * unmapped, so this will only try to map the rest of page, see
@@ -2640,7 +2657,8 @@ int __page_symlink(struct inode *inode, const char *symname, int len,
2640 */ 2657 */
2641 if (!PageUptodate(page)) { 2658 if (!PageUptodate(page)) {
2642 err = mapping->a_ops->readpage(NULL, page); 2659 err = mapping->a_ops->readpage(NULL, page);
2643 wait_on_page_locked(page); 2660 if (err != AOP_TRUNCATED_PAGE)
2661 wait_on_page_locked(page);
2644 } else { 2662 } else {
2645 unlock_page(page); 2663 unlock_page(page);
2646 } 2664 }