aboutsummaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 20cefe16eafb..43d071922b81 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -729,6 +729,8 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
729 (void) shmem_getpage(inode, 729 (void) shmem_getpage(inode,
730 attr->ia_size>>PAGE_CACHE_SHIFT, 730 attr->ia_size>>PAGE_CACHE_SHIFT,
731 &page, SGP_READ, NULL); 731 &page, SGP_READ, NULL);
732 if (page)
733 unlock_page(page);
732 } 734 }
733 /* 735 /*
734 * Reset SHMEM_PAGEIN flag so that shmem_truncate can 736 * Reset SHMEM_PAGEIN flag so that shmem_truncate can
@@ -1286,12 +1288,7 @@ repeat:
1286 SetPageUptodate(filepage); 1288 SetPageUptodate(filepage);
1287 } 1289 }
1288done: 1290done:
1289 if (*pagep != filepage) { 1291 *pagep = filepage;
1290 *pagep = filepage;
1291 if (sgp != SGP_CACHE)
1292 unlock_page(filepage);
1293
1294 }
1295 return 0; 1292 return 0;
1296 1293
1297failed: 1294failed:
@@ -1469,12 +1466,13 @@ shmem_write_end(struct file *file, struct address_space *mapping,
1469{ 1466{
1470 struct inode *inode = mapping->host; 1467 struct inode *inode = mapping->host;
1471 1468
1469 if (pos + copied > inode->i_size)
1470 i_size_write(inode, pos + copied);
1471
1472 unlock_page(page);
1472 set_page_dirty(page); 1473 set_page_dirty(page);
1473 page_cache_release(page); 1474 page_cache_release(page);
1474 1475
1475 if (pos+copied > inode->i_size)
1476 i_size_write(inode, pos+copied);
1477
1478 return copied; 1476 return copied;
1479} 1477}
1480 1478
@@ -1529,6 +1527,7 @@ shmem_file_write(struct file *file, const char __user *buf, size_t count, loff_t
1529 if (err) 1527 if (err)
1530 break; 1528 break;
1531 1529
1530 unlock_page(page);
1532 left = bytes; 1531 left = bytes;
1533 if (PageHighMem(page)) { 1532 if (PageHighMem(page)) {
1534 volatile unsigned char dummy; 1533 volatile unsigned char dummy;
@@ -1610,6 +1609,8 @@ static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_
1610 desc->error = 0; 1609 desc->error = 0;
1611 break; 1610 break;
1612 } 1611 }
1612 if (page)
1613 unlock_page(page);
1613 1614
1614 /* 1615 /*
1615 * We must evaluate after, since reads (unlike writes) 1616 * We must evaluate after, since reads (unlike writes)
@@ -1899,6 +1900,7 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
1899 iput(inode); 1900 iput(inode);
1900 return error; 1901 return error;
1901 } 1902 }
1903 unlock_page(page);
1902 inode->i_op = &shmem_symlink_inode_operations; 1904 inode->i_op = &shmem_symlink_inode_operations;
1903 kaddr = kmap_atomic(page, KM_USER0); 1905 kaddr = kmap_atomic(page, KM_USER0);
1904 memcpy(kaddr, symname, len); 1906 memcpy(kaddr, symname, len);
@@ -1926,6 +1928,8 @@ static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd)
1926 struct page *page = NULL; 1928 struct page *page = NULL;
1927 int res = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL); 1929 int res = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL);
1928 nd_set_link(nd, res ? ERR_PTR(res) : kmap(page)); 1930 nd_set_link(nd, res ? ERR_PTR(res) : kmap(page));
1931 if (page)
1932 unlock_page(page);
1929 return page; 1933 return page;
1930} 1934}
1931 1935