diff options
Diffstat (limited to 'fs')
60 files changed, 727 insertions, 567 deletions
@@ -1166,7 +1166,10 @@ retry: | |||
1166 | break; | 1166 | break; |
1167 | if (min_nr <= i) | 1167 | if (min_nr <= i) |
1168 | break; | 1168 | break; |
1169 | ret = 0; | 1169 | if (unlikely(ctx->dead)) { |
1170 | ret = -EINVAL; | ||
1171 | break; | ||
1172 | } | ||
1170 | if (to.timed_out) /* Only check after read evt */ | 1173 | if (to.timed_out) /* Only check after read evt */ |
1171 | break; | 1174 | break; |
1172 | /* Try to only show up in io wait if there are ops | 1175 | /* Try to only show up in io wait if there are ops |
@@ -1231,6 +1234,13 @@ static void io_destroy(struct kioctx *ioctx) | |||
1231 | 1234 | ||
1232 | aio_cancel_all(ioctx); | 1235 | aio_cancel_all(ioctx); |
1233 | wait_for_all_aios(ioctx); | 1236 | wait_for_all_aios(ioctx); |
1237 | |||
1238 | /* | ||
1239 | * Wake up any waiters. The setting of ctx->dead must be seen | ||
1240 | * by other CPUs at this point. Right now, we rely on the | ||
1241 | * locking done by the above calls to ensure this consistency. | ||
1242 | */ | ||
1243 | wake_up(&ioctx->wait); | ||
1234 | put_ioctx(ioctx); /* once for the lookup */ | 1244 | put_ioctx(ioctx); /* once for the lookup */ |
1235 | } | 1245 | } |
1236 | 1246 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index 39ff14403d13..3db4a26adc44 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -360,16 +360,19 @@ void invalidate_bdev(struct block_device *bdev) | |||
360 | */ | 360 | */ |
361 | static void free_more_memory(void) | 361 | static void free_more_memory(void) |
362 | { | 362 | { |
363 | struct zone **zones; | 363 | struct zone *zone; |
364 | pg_data_t *pgdat; | 364 | int nid; |
365 | 365 | ||
366 | wakeup_pdflush(1024); | 366 | wakeup_pdflush(1024); |
367 | yield(); | 367 | yield(); |
368 | 368 | ||
369 | for_each_online_pgdat(pgdat) { | 369 | for_each_online_node(nid) { |
370 | zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones; | 370 | (void)first_zones_zonelist(node_zonelist(nid, GFP_NOFS), |
371 | if (*zones) | 371 | gfp_zone(GFP_NOFS), NULL, |
372 | try_to_free_pages(zones, 0, GFP_NOFS); | 372 | &zone); |
373 | if (zone) | ||
374 | try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0, | ||
375 | GFP_NOFS); | ||
373 | } | 376 | } |
374 | } | 377 | } |
375 | 378 | ||
@@ -2243,6 +2246,8 @@ int cont_expand_zero(struct file *file, struct address_space *mapping, | |||
2243 | goto out; | 2246 | goto out; |
2244 | BUG_ON(err != len); | 2247 | BUG_ON(err != len); |
2245 | err = 0; | 2248 | err = 0; |
2249 | |||
2250 | balance_dirty_pages_ratelimited(mapping); | ||
2246 | } | 2251 | } |
2247 | 2252 | ||
2248 | /* page covers the boundary, find the boundary offset */ | 2253 | /* page covers the boundary, find the boundary offset */ |
@@ -3180,8 +3185,7 @@ static void recalc_bh_state(void) | |||
3180 | 3185 | ||
3181 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) | 3186 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) |
3182 | { | 3187 | { |
3183 | struct buffer_head *ret = kmem_cache_alloc(bh_cachep, | 3188 | struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); |
3184 | set_migrateflags(gfp_flags, __GFP_RECLAIMABLE)); | ||
3185 | if (ret) { | 3189 | if (ret) { |
3186 | INIT_LIST_HEAD(&ret->b_assoc_buffers); | 3190 | INIT_LIST_HEAD(&ret->b_assoc_buffers); |
3187 | get_cpu_var(bh_accounting).nr++; | 3191 | get_cpu_var(bh_accounting).nr++; |
diff --git a/fs/dquot.c b/fs/dquot.c index 41b9dbd68b0e..dfba1623cccb 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -289,7 +289,15 @@ static void wait_on_dquot(struct dquot *dquot) | |||
289 | mutex_unlock(&dquot->dq_lock); | 289 | mutex_unlock(&dquot->dq_lock); |
290 | } | 290 | } |
291 | 291 | ||
292 | #define mark_dquot_dirty(dquot) ((dquot)->dq_sb->dq_op->mark_dirty(dquot)) | 292 | static inline int dquot_dirty(struct dquot *dquot) |
293 | { | ||
294 | return test_bit(DQ_MOD_B, &dquot->dq_flags); | ||
295 | } | ||
296 | |||
297 | static inline int mark_dquot_dirty(struct dquot *dquot) | ||
298 | { | ||
299 | return dquot->dq_sb->dq_op->mark_dirty(dquot); | ||
300 | } | ||
293 | 301 | ||
294 | int dquot_mark_dquot_dirty(struct dquot *dquot) | 302 | int dquot_mark_dquot_dirty(struct dquot *dquot) |
295 | { | 303 | { |
@@ -1441,31 +1449,43 @@ static inline void set_enable_flags(struct quota_info *dqopt, int type) | |||
1441 | switch (type) { | 1449 | switch (type) { |
1442 | case USRQUOTA: | 1450 | case USRQUOTA: |
1443 | dqopt->flags |= DQUOT_USR_ENABLED; | 1451 | dqopt->flags |= DQUOT_USR_ENABLED; |
1452 | dqopt->flags &= ~DQUOT_USR_SUSPENDED; | ||
1444 | break; | 1453 | break; |
1445 | case GRPQUOTA: | 1454 | case GRPQUOTA: |
1446 | dqopt->flags |= DQUOT_GRP_ENABLED; | 1455 | dqopt->flags |= DQUOT_GRP_ENABLED; |
1456 | dqopt->flags &= ~DQUOT_GRP_SUSPENDED; | ||
1447 | break; | 1457 | break; |
1448 | } | 1458 | } |
1449 | } | 1459 | } |
1450 | 1460 | ||
1451 | static inline void reset_enable_flags(struct quota_info *dqopt, int type) | 1461 | static inline void reset_enable_flags(struct quota_info *dqopt, int type, |
1462 | int remount) | ||
1452 | { | 1463 | { |
1453 | switch (type) { | 1464 | switch (type) { |
1454 | case USRQUOTA: | 1465 | case USRQUOTA: |
1455 | dqopt->flags &= ~DQUOT_USR_ENABLED; | 1466 | dqopt->flags &= ~DQUOT_USR_ENABLED; |
1467 | if (remount) | ||
1468 | dqopt->flags |= DQUOT_USR_SUSPENDED; | ||
1469 | else | ||
1470 | dqopt->flags &= ~DQUOT_USR_SUSPENDED; | ||
1456 | break; | 1471 | break; |
1457 | case GRPQUOTA: | 1472 | case GRPQUOTA: |
1458 | dqopt->flags &= ~DQUOT_GRP_ENABLED; | 1473 | dqopt->flags &= ~DQUOT_GRP_ENABLED; |
1474 | if (remount) | ||
1475 | dqopt->flags |= DQUOT_GRP_SUSPENDED; | ||
1476 | else | ||
1477 | dqopt->flags &= ~DQUOT_GRP_SUSPENDED; | ||
1459 | break; | 1478 | break; |
1460 | } | 1479 | } |
1461 | } | 1480 | } |
1462 | 1481 | ||
1482 | |||
1463 | /* | 1483 | /* |
1464 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) | 1484 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) |
1465 | */ | 1485 | */ |
1466 | int vfs_quota_off(struct super_block *sb, int type) | 1486 | int vfs_quota_off(struct super_block *sb, int type, int remount) |
1467 | { | 1487 | { |
1468 | int cnt; | 1488 | int cnt, ret = 0; |
1469 | struct quota_info *dqopt = sb_dqopt(sb); | 1489 | struct quota_info *dqopt = sb_dqopt(sb); |
1470 | struct inode *toputinode[MAXQUOTAS]; | 1490 | struct inode *toputinode[MAXQUOTAS]; |
1471 | 1491 | ||
@@ -1475,9 +1495,17 @@ int vfs_quota_off(struct super_block *sb, int type) | |||
1475 | toputinode[cnt] = NULL; | 1495 | toputinode[cnt] = NULL; |
1476 | if (type != -1 && cnt != type) | 1496 | if (type != -1 && cnt != type) |
1477 | continue; | 1497 | continue; |
1498 | /* If we keep inodes of quota files after remount and quotaoff | ||
1499 | * is called, drop kept inodes. */ | ||
1500 | if (!remount && sb_has_quota_suspended(sb, cnt)) { | ||
1501 | iput(dqopt->files[cnt]); | ||
1502 | dqopt->files[cnt] = NULL; | ||
1503 | reset_enable_flags(dqopt, cnt, 0); | ||
1504 | continue; | ||
1505 | } | ||
1478 | if (!sb_has_quota_enabled(sb, cnt)) | 1506 | if (!sb_has_quota_enabled(sb, cnt)) |
1479 | continue; | 1507 | continue; |
1480 | reset_enable_flags(dqopt, cnt); | 1508 | reset_enable_flags(dqopt, cnt, remount); |
1481 | 1509 | ||
1482 | /* Note: these are blocking operations */ | 1510 | /* Note: these are blocking operations */ |
1483 | drop_dquot_ref(sb, cnt); | 1511 | drop_dquot_ref(sb, cnt); |
@@ -1493,7 +1521,8 @@ int vfs_quota_off(struct super_block *sb, int type) | |||
1493 | put_quota_format(dqopt->info[cnt].dqi_format); | 1521 | put_quota_format(dqopt->info[cnt].dqi_format); |
1494 | 1522 | ||
1495 | toputinode[cnt] = dqopt->files[cnt]; | 1523 | toputinode[cnt] = dqopt->files[cnt]; |
1496 | dqopt->files[cnt] = NULL; | 1524 | if (!remount) |
1525 | dqopt->files[cnt] = NULL; | ||
1497 | dqopt->info[cnt].dqi_flags = 0; | 1526 | dqopt->info[cnt].dqi_flags = 0; |
1498 | dqopt->info[cnt].dqi_igrace = 0; | 1527 | dqopt->info[cnt].dqi_igrace = 0; |
1499 | dqopt->info[cnt].dqi_bgrace = 0; | 1528 | dqopt->info[cnt].dqi_bgrace = 0; |
@@ -1523,12 +1552,19 @@ int vfs_quota_off(struct super_block *sb, int type) | |||
1523 | mutex_unlock(&toputinode[cnt]->i_mutex); | 1552 | mutex_unlock(&toputinode[cnt]->i_mutex); |
1524 | mark_inode_dirty(toputinode[cnt]); | 1553 | mark_inode_dirty(toputinode[cnt]); |
1525 | } | 1554 | } |
1526 | iput(toputinode[cnt]); | ||
1527 | mutex_unlock(&dqopt->dqonoff_mutex); | 1555 | mutex_unlock(&dqopt->dqonoff_mutex); |
1556 | /* On remount RO, we keep the inode pointer so that we | ||
1557 | * can reenable quota on the subsequent remount RW. | ||
1558 | * But we have better not keep inode pointer when there | ||
1559 | * is pending delete on the quota file... */ | ||
1560 | if (!remount) | ||
1561 | iput(toputinode[cnt]); | ||
1562 | else if (!toputinode[cnt]->i_nlink) | ||
1563 | ret = -EBUSY; | ||
1528 | } | 1564 | } |
1529 | if (sb->s_bdev) | 1565 | if (sb->s_bdev) |
1530 | invalidate_bdev(sb->s_bdev); | 1566 | invalidate_bdev(sb->s_bdev); |
1531 | return 0; | 1567 | return ret; |
1532 | } | 1568 | } |
1533 | 1569 | ||
1534 | /* | 1570 | /* |
@@ -1566,7 +1602,8 @@ static int vfs_quota_on_inode(struct inode *inode, int type, int format_id) | |||
1566 | invalidate_bdev(sb->s_bdev); | 1602 | invalidate_bdev(sb->s_bdev); |
1567 | mutex_lock(&inode->i_mutex); | 1603 | mutex_lock(&inode->i_mutex); |
1568 | mutex_lock(&dqopt->dqonoff_mutex); | 1604 | mutex_lock(&dqopt->dqonoff_mutex); |
1569 | if (sb_has_quota_enabled(sb, type)) { | 1605 | if (sb_has_quota_enabled(sb, type) || |
1606 | sb_has_quota_suspended(sb, type)) { | ||
1570 | error = -EBUSY; | 1607 | error = -EBUSY; |
1571 | goto out_lock; | 1608 | goto out_lock; |
1572 | } | 1609 | } |
@@ -1589,6 +1626,7 @@ static int vfs_quota_on_inode(struct inode *inode, int type, int format_id) | |||
1589 | 1626 | ||
1590 | dqopt->ops[type] = fmt->qf_ops; | 1627 | dqopt->ops[type] = fmt->qf_ops; |
1591 | dqopt->info[type].dqi_format = fmt; | 1628 | dqopt->info[type].dqi_format = fmt; |
1629 | dqopt->info[type].dqi_fmt_id = format_id; | ||
1592 | INIT_LIST_HEAD(&dqopt->info[type].dqi_dirty_list); | 1630 | INIT_LIST_HEAD(&dqopt->info[type].dqi_dirty_list); |
1593 | mutex_lock(&dqopt->dqio_mutex); | 1631 | mutex_lock(&dqopt->dqio_mutex); |
1594 | if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) { | 1632 | if ((error = dqopt->ops[type]->read_file_info(sb, type)) < 0) { |
@@ -1624,12 +1662,41 @@ out_fmt: | |||
1624 | return error; | 1662 | return error; |
1625 | } | 1663 | } |
1626 | 1664 | ||
1665 | /* Reenable quotas on remount RW */ | ||
1666 | static int vfs_quota_on_remount(struct super_block *sb, int type) | ||
1667 | { | ||
1668 | struct quota_info *dqopt = sb_dqopt(sb); | ||
1669 | struct inode *inode; | ||
1670 | int ret; | ||
1671 | |||
1672 | mutex_lock(&dqopt->dqonoff_mutex); | ||
1673 | if (!sb_has_quota_suspended(sb, type)) { | ||
1674 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
1675 | return 0; | ||
1676 | } | ||
1677 | BUG_ON(sb_has_quota_enabled(sb, type)); | ||
1678 | |||
1679 | inode = dqopt->files[type]; | ||
1680 | dqopt->files[type] = NULL; | ||
1681 | reset_enable_flags(dqopt, type, 0); | ||
1682 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
1683 | |||
1684 | ret = vfs_quota_on_inode(inode, type, dqopt->info[type].dqi_fmt_id); | ||
1685 | iput(inode); | ||
1686 | |||
1687 | return ret; | ||
1688 | } | ||
1689 | |||
1627 | /* Actual function called from quotactl() */ | 1690 | /* Actual function called from quotactl() */ |
1628 | int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path) | 1691 | int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path, |
1692 | int remount) | ||
1629 | { | 1693 | { |
1630 | struct nameidata nd; | 1694 | struct nameidata nd; |
1631 | int error; | 1695 | int error; |
1632 | 1696 | ||
1697 | if (remount) | ||
1698 | return vfs_quota_on_remount(sb, type); | ||
1699 | |||
1633 | error = path_lookup(path, LOOKUP_FOLLOW, &nd); | 1700 | error = path_lookup(path, LOOKUP_FOLLOW, &nd); |
1634 | if (error < 0) | 1701 | if (error < 0) |
1635 | return error; | 1702 | return error; |
@@ -1709,10 +1776,19 @@ int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *d | |||
1709 | } | 1776 | } |
1710 | 1777 | ||
1711 | /* Generic routine for setting common part of quota structure */ | 1778 | /* Generic routine for setting common part of quota structure */ |
1712 | static void do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | 1779 | static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) |
1713 | { | 1780 | { |
1714 | struct mem_dqblk *dm = &dquot->dq_dqb; | 1781 | struct mem_dqblk *dm = &dquot->dq_dqb; |
1715 | int check_blim = 0, check_ilim = 0; | 1782 | int check_blim = 0, check_ilim = 0; |
1783 | struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_type]; | ||
1784 | |||
1785 | if ((di->dqb_valid & QIF_BLIMITS && | ||
1786 | (di->dqb_bhardlimit > dqi->dqi_maxblimit || | ||
1787 | di->dqb_bsoftlimit > dqi->dqi_maxblimit)) || | ||
1788 | (di->dqb_valid & QIF_ILIMITS && | ||
1789 | (di->dqb_ihardlimit > dqi->dqi_maxilimit || | ||
1790 | di->dqb_isoftlimit > dqi->dqi_maxilimit))) | ||
1791 | return -ERANGE; | ||
1716 | 1792 | ||
1717 | spin_lock(&dq_data_lock); | 1793 | spin_lock(&dq_data_lock); |
1718 | if (di->dqb_valid & QIF_SPACE) { | 1794 | if (di->dqb_valid & QIF_SPACE) { |
@@ -1744,7 +1820,7 @@ static void do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
1744 | clear_bit(DQ_BLKS_B, &dquot->dq_flags); | 1820 | clear_bit(DQ_BLKS_B, &dquot->dq_flags); |
1745 | } | 1821 | } |
1746 | else if (!(di->dqb_valid & QIF_BTIME)) /* Set grace only if user hasn't provided his own... */ | 1822 | else if (!(di->dqb_valid & QIF_BTIME)) /* Set grace only if user hasn't provided his own... */ |
1747 | dm->dqb_btime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_bgrace; | 1823 | dm->dqb_btime = get_seconds() + dqi->dqi_bgrace; |
1748 | } | 1824 | } |
1749 | if (check_ilim) { | 1825 | if (check_ilim) { |
1750 | if (!dm->dqb_isoftlimit || dm->dqb_curinodes < dm->dqb_isoftlimit) { | 1826 | if (!dm->dqb_isoftlimit || dm->dqb_curinodes < dm->dqb_isoftlimit) { |
@@ -1752,7 +1828,7 @@ static void do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
1752 | clear_bit(DQ_INODES_B, &dquot->dq_flags); | 1828 | clear_bit(DQ_INODES_B, &dquot->dq_flags); |
1753 | } | 1829 | } |
1754 | else if (!(di->dqb_valid & QIF_ITIME)) /* Set grace only if user hasn't provided his own... */ | 1830 | else if (!(di->dqb_valid & QIF_ITIME)) /* Set grace only if user hasn't provided his own... */ |
1755 | dm->dqb_itime = get_seconds() + sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; | 1831 | dm->dqb_itime = get_seconds() + dqi->dqi_igrace; |
1756 | } | 1832 | } |
1757 | if (dm->dqb_bhardlimit || dm->dqb_bsoftlimit || dm->dqb_ihardlimit || dm->dqb_isoftlimit) | 1833 | if (dm->dqb_bhardlimit || dm->dqb_bsoftlimit || dm->dqb_ihardlimit || dm->dqb_isoftlimit) |
1758 | clear_bit(DQ_FAKE_B, &dquot->dq_flags); | 1834 | clear_bit(DQ_FAKE_B, &dquot->dq_flags); |
@@ -1760,21 +1836,24 @@ static void do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
1760 | set_bit(DQ_FAKE_B, &dquot->dq_flags); | 1836 | set_bit(DQ_FAKE_B, &dquot->dq_flags); |
1761 | spin_unlock(&dq_data_lock); | 1837 | spin_unlock(&dq_data_lock); |
1762 | mark_dquot_dirty(dquot); | 1838 | mark_dquot_dirty(dquot); |
1839 | |||
1840 | return 0; | ||
1763 | } | 1841 | } |
1764 | 1842 | ||
1765 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di) | 1843 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di) |
1766 | { | 1844 | { |
1767 | struct dquot *dquot; | 1845 | struct dquot *dquot; |
1846 | int rc; | ||
1768 | 1847 | ||
1769 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); | 1848 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); |
1770 | if (!(dquot = dqget(sb, id, type))) { | 1849 | if (!(dquot = dqget(sb, id, type))) { |
1771 | mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); | 1850 | mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); |
1772 | return -ESRCH; | 1851 | return -ESRCH; |
1773 | } | 1852 | } |
1774 | do_set_dqblk(dquot, di); | 1853 | rc = do_set_dqblk(dquot, di); |
1775 | dqput(dquot); | 1854 | dqput(dquot); |
1776 | mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); | 1855 | mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); |
1777 | return 0; | 1856 | return rc; |
1778 | } | 1857 | } |
1779 | 1858 | ||
1780 | /* Generic routine for getting common part of quota file information */ | 1859 | /* Generic routine for getting common part of quota file information */ |
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index e7b2bafa1dd9..10bb02c3f25c 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c | |||
@@ -106,7 +106,7 @@ static int ext2_valid_block_bitmap(struct super_block *sb, | |||
106 | return 1; | 106 | return 1; |
107 | 107 | ||
108 | err_out: | 108 | err_out: |
109 | ext2_error(sb, __FUNCTION__, | 109 | ext2_error(sb, __func__, |
110 | "Invalid block bitmap - " | 110 | "Invalid block bitmap - " |
111 | "block_group = %d, block = %lu", | 111 | "block_group = %d, block = %lu", |
112 | block_group, bitmap_blk); | 112 | block_group, bitmap_blk); |
@@ -132,7 +132,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
132 | bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); | 132 | bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); |
133 | bh = sb_getblk(sb, bitmap_blk); | 133 | bh = sb_getblk(sb, bitmap_blk); |
134 | if (unlikely(!bh)) { | 134 | if (unlikely(!bh)) { |
135 | ext2_error(sb, __FUNCTION__, | 135 | ext2_error(sb, __func__, |
136 | "Cannot read block bitmap - " | 136 | "Cannot read block bitmap - " |
137 | "block_group = %d, block_bitmap = %u", | 137 | "block_group = %d, block_bitmap = %u", |
138 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 138 | block_group, le32_to_cpu(desc->bg_block_bitmap)); |
@@ -143,17 +143,18 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
143 | 143 | ||
144 | if (bh_submit_read(bh) < 0) { | 144 | if (bh_submit_read(bh) < 0) { |
145 | brelse(bh); | 145 | brelse(bh); |
146 | ext2_error(sb, __FUNCTION__, | 146 | ext2_error(sb, __func__, |
147 | "Cannot read block bitmap - " | 147 | "Cannot read block bitmap - " |
148 | "block_group = %d, block_bitmap = %u", | 148 | "block_group = %d, block_bitmap = %u", |
149 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 149 | block_group, le32_to_cpu(desc->bg_block_bitmap)); |
150 | return NULL; | 150 | return NULL; |
151 | } | 151 | } |
152 | if (!ext2_valid_block_bitmap(sb, desc, block_group, bh)) { | ||
153 | brelse(bh); | ||
154 | return NULL; | ||
155 | } | ||
156 | 152 | ||
153 | ext2_valid_block_bitmap(sb, desc, block_group, bh); | ||
154 | /* | ||
155 | * file system mounted not to panic on error, continue with corrupt | ||
156 | * bitmap | ||
157 | */ | ||
157 | return bh; | 158 | return bh; |
158 | } | 159 | } |
159 | 160 | ||
@@ -245,11 +246,10 @@ restart: | |||
245 | prev = rsv; | 246 | prev = rsv; |
246 | } | 247 | } |
247 | printk("Window map complete.\n"); | 248 | printk("Window map complete.\n"); |
248 | if (bad) | 249 | BUG_ON(bad); |
249 | BUG(); | ||
250 | } | 250 | } |
251 | #define rsv_window_dump(root, verbose) \ | 251 | #define rsv_window_dump(root, verbose) \ |
252 | __rsv_window_dump((root), (verbose), __FUNCTION__) | 252 | __rsv_window_dump((root), (verbose), __func__) |
253 | #else | 253 | #else |
254 | #define rsv_window_dump(root, verbose) do {} while (0) | 254 | #define rsv_window_dump(root, verbose) do {} while (0) |
255 | #endif | 255 | #endif |
@@ -548,7 +548,7 @@ do_more: | |||
548 | for (i = 0, group_freed = 0; i < count; i++) { | 548 | for (i = 0, group_freed = 0; i < count; i++) { |
549 | if (!ext2_clear_bit_atomic(sb_bgl_lock(sbi, block_group), | 549 | if (!ext2_clear_bit_atomic(sb_bgl_lock(sbi, block_group), |
550 | bit + i, bitmap_bh->b_data)) { | 550 | bit + i, bitmap_bh->b_data)) { |
551 | ext2_error(sb, __FUNCTION__, | 551 | ext2_error(sb, __func__, |
552 | "bit already cleared for block %lu", block + i); | 552 | "bit already cleared for block %lu", block + i); |
553 | } else { | 553 | } else { |
554 | group_freed++; | 554 | group_freed++; |
@@ -1381,7 +1381,12 @@ allocated: | |||
1381 | "Allocating block in system zone - " | 1381 | "Allocating block in system zone - " |
1382 | "blocks from "E2FSBLK", length %lu", | 1382 | "blocks from "E2FSBLK", length %lu", |
1383 | ret_block, num); | 1383 | ret_block, num); |
1384 | goto out; | 1384 | /* |
1385 | * ext2_try_to_allocate marked the blocks we allocated as in | ||
1386 | * use. So we may want to selectively mark some of the blocks | ||
1387 | * as free | ||
1388 | */ | ||
1389 | goto retry_alloc; | ||
1385 | } | 1390 | } |
1386 | 1391 | ||
1387 | performed_allocation = 1; | 1392 | performed_allocation = 1; |
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 8dededd80fe2..a78c6b4af060 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -41,8 +41,8 @@ static inline __le16 ext2_rec_len_to_disk(unsigned len) | |||
41 | { | 41 | { |
42 | if (len == (1 << 16)) | 42 | if (len == (1 << 16)) |
43 | return cpu_to_le16(EXT2_MAX_REC_LEN); | 43 | return cpu_to_le16(EXT2_MAX_REC_LEN); |
44 | else if (len > (1 << 16)) | 44 | else |
45 | BUG(); | 45 | BUG_ON(len > (1 << 16)); |
46 | return cpu_to_le16(len); | 46 | return cpu_to_le16(len); |
47 | } | 47 | } |
48 | 48 | ||
@@ -295,11 +295,11 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) | |||
295 | struct page *page = ext2_get_page(inode, n); | 295 | struct page *page = ext2_get_page(inode, n); |
296 | 296 | ||
297 | if (IS_ERR(page)) { | 297 | if (IS_ERR(page)) { |
298 | ext2_error(sb, __FUNCTION__, | 298 | ext2_error(sb, __func__, |
299 | "bad page in #%lu", | 299 | "bad page in #%lu", |
300 | inode->i_ino); | 300 | inode->i_ino); |
301 | filp->f_pos += PAGE_CACHE_SIZE - offset; | 301 | filp->f_pos += PAGE_CACHE_SIZE - offset; |
302 | return -EIO; | 302 | return PTR_ERR(page); |
303 | } | 303 | } |
304 | kaddr = page_address(page); | 304 | kaddr = page_address(page); |
305 | if (unlikely(need_revalidate)) { | 305 | if (unlikely(need_revalidate)) { |
@@ -314,7 +314,7 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir) | |||
314 | limit = kaddr + ext2_last_byte(inode, n) - EXT2_DIR_REC_LEN(1); | 314 | limit = kaddr + ext2_last_byte(inode, n) - EXT2_DIR_REC_LEN(1); |
315 | for ( ;(char*)de <= limit; de = ext2_next_entry(de)) { | 315 | for ( ;(char*)de <= limit; de = ext2_next_entry(de)) { |
316 | if (de->rec_len == 0) { | 316 | if (de->rec_len == 0) { |
317 | ext2_error(sb, __FUNCTION__, | 317 | ext2_error(sb, __func__, |
318 | "zero-length directory entry"); | 318 | "zero-length directory entry"); |
319 | ext2_put_page(page); | 319 | ext2_put_page(page); |
320 | return -EIO; | 320 | return -EIO; |
@@ -381,7 +381,7 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir, | |||
381 | kaddr += ext2_last_byte(dir, n) - reclen; | 381 | kaddr += ext2_last_byte(dir, n) - reclen; |
382 | while ((char *) de <= kaddr) { | 382 | while ((char *) de <= kaddr) { |
383 | if (de->rec_len == 0) { | 383 | if (de->rec_len == 0) { |
384 | ext2_error(dir->i_sb, __FUNCTION__, | 384 | ext2_error(dir->i_sb, __func__, |
385 | "zero-length directory entry"); | 385 | "zero-length directory entry"); |
386 | ext2_put_page(page); | 386 | ext2_put_page(page); |
387 | goto out; | 387 | goto out; |
@@ -396,7 +396,7 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir, | |||
396 | n = 0; | 396 | n = 0; |
397 | /* next page is past the blocks we've got */ | 397 | /* next page is past the blocks we've got */ |
398 | if (unlikely(n > (dir->i_blocks >> (PAGE_CACHE_SHIFT - 9)))) { | 398 | if (unlikely(n > (dir->i_blocks >> (PAGE_CACHE_SHIFT - 9)))) { |
399 | ext2_error(dir->i_sb, __FUNCTION__, | 399 | ext2_error(dir->i_sb, __func__, |
400 | "dir %lu size %lld exceeds block count %llu", | 400 | "dir %lu size %lld exceeds block count %llu", |
401 | dir->i_ino, dir->i_size, | 401 | dir->i_ino, dir->i_size, |
402 | (unsigned long long)dir->i_blocks); | 402 | (unsigned long long)dir->i_blocks); |
@@ -506,7 +506,7 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) | |||
506 | goto got_it; | 506 | goto got_it; |
507 | } | 507 | } |
508 | if (de->rec_len == 0) { | 508 | if (de->rec_len == 0) { |
509 | ext2_error(dir->i_sb, __FUNCTION__, | 509 | ext2_error(dir->i_sb, __func__, |
510 | "zero-length directory entry"); | 510 | "zero-length directory entry"); |
511 | err = -EIO; | 511 | err = -EIO; |
512 | goto out_unlock; | 512 | goto out_unlock; |
@@ -578,7 +578,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page ) | |||
578 | 578 | ||
579 | while ((char*)de < (char*)dir) { | 579 | while ((char*)de < (char*)dir) { |
580 | if (de->rec_len == 0) { | 580 | if (de->rec_len == 0) { |
581 | ext2_error(inode->i_sb, __FUNCTION__, | 581 | ext2_error(inode->i_sb, __func__, |
582 | "zero-length directory entry"); | 582 | "zero-length directory entry"); |
583 | err = -EIO; | 583 | err = -EIO; |
584 | goto out; | 584 | goto out; |
@@ -670,7 +670,7 @@ int ext2_empty_dir (struct inode * inode) | |||
670 | 670 | ||
671 | while ((char *)de <= kaddr) { | 671 | while ((char *)de <= kaddr) { |
672 | if (de->rec_len == 0) { | 672 | if (de->rec_len == 0) { |
673 | ext2_error(inode->i_sb, __FUNCTION__, | 673 | ext2_error(inode->i_sb, __func__, |
674 | "zero-length directory entry"); | 674 | "zero-length directory entry"); |
675 | printk("kaddr=%p, de=%p\n", kaddr, de); | 675 | printk("kaddr=%p, de=%p\n", kaddr, de); |
676 | goto not_empty; | 676 | goto not_empty; |
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 08f647d8188d..f59741346760 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -75,11 +75,9 @@ static void ext2_release_inode(struct super_block *sb, int group, int dir) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | spin_lock(sb_bgl_lock(EXT2_SB(sb), group)); | 77 | spin_lock(sb_bgl_lock(EXT2_SB(sb), group)); |
78 | desc->bg_free_inodes_count = | 78 | le16_add_cpu(&desc->bg_free_inodes_count, 1); |
79 | cpu_to_le16(le16_to_cpu(desc->bg_free_inodes_count) + 1); | ||
80 | if (dir) | 79 | if (dir) |
81 | desc->bg_used_dirs_count = | 80 | le16_add_cpu(&desc->bg_used_dirs_count, -1); |
82 | cpu_to_le16(le16_to_cpu(desc->bg_used_dirs_count) - 1); | ||
83 | spin_unlock(sb_bgl_lock(EXT2_SB(sb), group)); | 81 | spin_unlock(sb_bgl_lock(EXT2_SB(sb), group)); |
84 | if (dir) | 82 | if (dir) |
85 | percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter); | 83 | percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter); |
@@ -539,13 +537,11 @@ got: | |||
539 | percpu_counter_inc(&sbi->s_dirs_counter); | 537 | percpu_counter_inc(&sbi->s_dirs_counter); |
540 | 538 | ||
541 | spin_lock(sb_bgl_lock(sbi, group)); | 539 | spin_lock(sb_bgl_lock(sbi, group)); |
542 | gdp->bg_free_inodes_count = | 540 | le16_add_cpu(&gdp->bg_free_inodes_count, -1); |
543 | cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1); | ||
544 | if (S_ISDIR(mode)) { | 541 | if (S_ISDIR(mode)) { |
545 | if (sbi->s_debts[group] < 255) | 542 | if (sbi->s_debts[group] < 255) |
546 | sbi->s_debts[group]++; | 543 | sbi->s_debts[group]++; |
547 | gdp->bg_used_dirs_count = | 544 | le16_add_cpu(&gdp->bg_used_dirs_count, 1); |
548 | cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1); | ||
549 | } else { | 545 | } else { |
550 | if (sbi->s_debts[group]) | 546 | if (sbi->s_debts[group]) |
551 | sbi->s_debts[group]--; | 547 | sbi->s_debts[group]--; |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index b8a2990bab83..384fc0d1dd74 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -254,13 +254,13 @@ no_block: | |||
254 | * Caller must make sure that @ind is valid and will stay that way. | 254 | * Caller must make sure that @ind is valid and will stay that way. |
255 | */ | 255 | */ |
256 | 256 | ||
257 | static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) | 257 | static ext2_fsblk_t ext2_find_near(struct inode *inode, Indirect *ind) |
258 | { | 258 | { |
259 | struct ext2_inode_info *ei = EXT2_I(inode); | 259 | struct ext2_inode_info *ei = EXT2_I(inode); |
260 | __le32 *start = ind->bh ? (__le32 *) ind->bh->b_data : ei->i_data; | 260 | __le32 *start = ind->bh ? (__le32 *) ind->bh->b_data : ei->i_data; |
261 | __le32 *p; | 261 | __le32 *p; |
262 | unsigned long bg_start; | 262 | ext2_fsblk_t bg_start; |
263 | unsigned long colour; | 263 | ext2_fsblk_t colour; |
264 | 264 | ||
265 | /* Try to find previous block */ | 265 | /* Try to find previous block */ |
266 | for (p = ind->p - 1; p >= start; p--) | 266 | for (p = ind->p - 1; p >= start; p--) |
@@ -275,8 +275,7 @@ static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) | |||
275 | * It is going to be refered from inode itself? OK, just put it into | 275 | * It is going to be refered from inode itself? OK, just put it into |
276 | * the same cylinder group then. | 276 | * the same cylinder group then. |
277 | */ | 277 | */ |
278 | bg_start = (ei->i_block_group * EXT2_BLOCKS_PER_GROUP(inode->i_sb)) + | 278 | bg_start = ext2_group_first_block_no(inode->i_sb, ei->i_block_group); |
279 | le32_to_cpu(EXT2_SB(inode->i_sb)->s_es->s_first_data_block); | ||
280 | colour = (current->pid % 16) * | 279 | colour = (current->pid % 16) * |
281 | (EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16); | 280 | (EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16); |
282 | return bg_start + colour; | 281 | return bg_start + colour; |
@@ -291,8 +290,8 @@ static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) | |||
291 | * Returns preferred place for a block (the goal). | 290 | * Returns preferred place for a block (the goal). |
292 | */ | 291 | */ |
293 | 292 | ||
294 | static inline int ext2_find_goal(struct inode *inode, long block, | 293 | static inline ext2_fsblk_t ext2_find_goal(struct inode *inode, long block, |
295 | Indirect *partial) | 294 | Indirect *partial) |
296 | { | 295 | { |
297 | struct ext2_block_alloc_info *block_i; | 296 | struct ext2_block_alloc_info *block_i; |
298 | 297 | ||
@@ -796,7 +795,7 @@ const struct address_space_operations ext2_aops = { | |||
796 | 795 | ||
797 | const struct address_space_operations ext2_aops_xip = { | 796 | const struct address_space_operations ext2_aops_xip = { |
798 | .bmap = ext2_bmap, | 797 | .bmap = ext2_bmap, |
799 | .get_xip_page = ext2_get_xip_page, | 798 | .get_xip_mem = ext2_get_xip_mem, |
800 | }; | 799 | }; |
801 | 800 | ||
802 | const struct address_space_operations ext2_nobh_aops = { | 801 | const struct address_space_operations ext2_nobh_aops = { |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 088b011bb97e..ef50cbc792db 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -51,8 +51,7 @@ void ext2_error (struct super_block * sb, const char * function, | |||
51 | 51 | ||
52 | if (!(sb->s_flags & MS_RDONLY)) { | 52 | if (!(sb->s_flags & MS_RDONLY)) { |
53 | sbi->s_mount_state |= EXT2_ERROR_FS; | 53 | sbi->s_mount_state |= EXT2_ERROR_FS; |
54 | es->s_state = | 54 | es->s_state |= cpu_to_le16(EXT2_ERROR_FS); |
55 | cpu_to_le16(le16_to_cpu(es->s_state) | EXT2_ERROR_FS); | ||
56 | ext2_sync_super(sb, es); | 55 | ext2_sync_super(sb, es); |
57 | } | 56 | } |
58 | 57 | ||
@@ -90,7 +89,7 @@ void ext2_update_dynamic_rev(struct super_block *sb) | |||
90 | if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) | 89 | if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) |
91 | return; | 90 | return; |
92 | 91 | ||
93 | ext2_warning(sb, __FUNCTION__, | 92 | ext2_warning(sb, __func__, |
94 | "updating to rev %d because of new feature flag, " | 93 | "updating to rev %d because of new feature flag, " |
95 | "running e2fsck is recommended", | 94 | "running e2fsck is recommended", |
96 | EXT2_DYNAMIC_REV); | 95 | EXT2_DYNAMIC_REV); |
@@ -604,7 +603,7 @@ static int ext2_setup_super (struct super_block * sb, | |||
604 | "running e2fsck is recommended\n"); | 603 | "running e2fsck is recommended\n"); |
605 | if (!le16_to_cpu(es->s_max_mnt_count)) | 604 | if (!le16_to_cpu(es->s_max_mnt_count)) |
606 | es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); | 605 | es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); |
607 | es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); | 606 | le16_add_cpu(&es->s_mnt_count, 1); |
608 | ext2_write_super(sb); | 607 | ext2_write_super(sb); |
609 | if (test_opt (sb, DEBUG)) | 608 | if (test_opt (sb, DEBUG)) |
610 | printk ("[EXT II FS %s, %s, bs=%lu, fs=%lu, gc=%lu, " | 609 | printk ("[EXT II FS %s, %s, bs=%lu, fs=%lu, gc=%lu, " |
@@ -622,13 +621,13 @@ static int ext2_check_descriptors(struct super_block *sb) | |||
622 | { | 621 | { |
623 | int i; | 622 | int i; |
624 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 623 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
625 | unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
626 | unsigned long last_block; | ||
627 | 624 | ||
628 | ext2_debug ("Checking group descriptors"); | 625 | ext2_debug ("Checking group descriptors"); |
629 | 626 | ||
630 | for (i = 0; i < sbi->s_groups_count; i++) { | 627 | for (i = 0; i < sbi->s_groups_count; i++) { |
631 | struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); | 628 | struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); |
629 | ext2_fsblk_t first_block = ext2_group_first_block_no(sb, i); | ||
630 | ext2_fsblk_t last_block; | ||
632 | 631 | ||
633 | if (i == sbi->s_groups_count - 1) | 632 | if (i == sbi->s_groups_count - 1) |
634 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 633 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
@@ -664,7 +663,6 @@ static int ext2_check_descriptors(struct super_block *sb) | |||
664 | i, (unsigned long) le32_to_cpu(gdp->bg_inode_table)); | 663 | i, (unsigned long) le32_to_cpu(gdp->bg_inode_table)); |
665 | return 0; | 664 | return 0; |
666 | } | 665 | } |
667 | first_block += EXT2_BLOCKS_PER_GROUP(sb); | ||
668 | } | 666 | } |
669 | return 1; | 667 | return 1; |
670 | } | 668 | } |
@@ -721,10 +719,9 @@ static unsigned long descriptor_loc(struct super_block *sb, | |||
721 | int nr) | 719 | int nr) |
722 | { | 720 | { |
723 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 721 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
724 | unsigned long bg, first_data_block, first_meta_bg; | 722 | unsigned long bg, first_meta_bg; |
725 | int has_super = 0; | 723 | int has_super = 0; |
726 | 724 | ||
727 | first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
728 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); | 725 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); |
729 | 726 | ||
730 | if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_META_BG) || | 727 | if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_META_BG) || |
@@ -733,7 +730,8 @@ static unsigned long descriptor_loc(struct super_block *sb, | |||
733 | bg = sbi->s_desc_per_block * nr; | 730 | bg = sbi->s_desc_per_block * nr; |
734 | if (ext2_bg_has_super(sb, bg)) | 731 | if (ext2_bg_has_super(sb, bg)) |
735 | has_super = 1; | 732 | has_super = 1; |
736 | return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); | 733 | |
734 | return ext2_group_first_block_no(sb, bg) + has_super; | ||
737 | } | 735 | } |
738 | 736 | ||
739 | static int ext2_fill_super(struct super_block *sb, void *data, int silent) | 737 | static int ext2_fill_super(struct super_block *sb, void *data, int silent) |
@@ -1062,7 +1060,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
1062 | goto failed_mount3; | 1060 | goto failed_mount3; |
1063 | } | 1061 | } |
1064 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 1062 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) |
1065 | ext2_warning(sb, __FUNCTION__, | 1063 | ext2_warning(sb, __func__, |
1066 | "mounting ext3 filesystem as ext2"); | 1064 | "mounting ext3 filesystem as ext2"); |
1067 | ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); | 1065 | ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); |
1068 | return 0; | 1066 | return 0; |
@@ -1126,10 +1124,9 @@ void ext2_write_super (struct super_block * sb) | |||
1126 | if (!(sb->s_flags & MS_RDONLY)) { | 1124 | if (!(sb->s_flags & MS_RDONLY)) { |
1127 | es = EXT2_SB(sb)->s_es; | 1125 | es = EXT2_SB(sb)->s_es; |
1128 | 1126 | ||
1129 | if (le16_to_cpu(es->s_state) & EXT2_VALID_FS) { | 1127 | if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) { |
1130 | ext2_debug ("setting valid to 0\n"); | 1128 | ext2_debug ("setting valid to 0\n"); |
1131 | es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & | 1129 | es->s_state &= cpu_to_le16(~EXT2_VALID_FS); |
1132 | ~EXT2_VALID_FS); | ||
1133 | es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); | 1130 | es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); |
1134 | es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); | 1131 | es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); |
1135 | es->s_mtime = cpu_to_le32(get_seconds()); | 1132 | es->s_mtime = cpu_to_le32(get_seconds()); |
@@ -1180,7 +1177,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1180 | if (((sbi->s_mount_opt & EXT2_MOUNT_XIP) != | 1177 | if (((sbi->s_mount_opt & EXT2_MOUNT_XIP) != |
1181 | (old_mount_opt & EXT2_MOUNT_XIP)) && | 1178 | (old_mount_opt & EXT2_MOUNT_XIP)) && |
1182 | invalidate_inodes(sb)) | 1179 | invalidate_inodes(sb)) |
1183 | ext2_warning(sb, __FUNCTION__, "busy inodes while remounting "\ | 1180 | ext2_warning(sb, __func__, "busy inodes while remounting "\ |
1184 | "xip remain in cache (no functional problem)"); | 1181 | "xip remain in cache (no functional problem)"); |
1185 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 1182 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) |
1186 | return 0; | 1183 | return 0; |
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index a99d46f3b26e..987a5261cc2e 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
@@ -646,8 +646,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
646 | unlock_buffer(new_bh); | 646 | unlock_buffer(new_bh); |
647 | goto cleanup; | 647 | goto cleanup; |
648 | } | 648 | } |
649 | HDR(new_bh)->h_refcount = cpu_to_le32(1 + | 649 | le32_add_cpu(&HDR(new_bh)->h_refcount, 1); |
650 | le32_to_cpu(HDR(new_bh)->h_refcount)); | ||
651 | ea_bdebug(new_bh, "refcount now=%d", | 650 | ea_bdebug(new_bh, "refcount now=%d", |
652 | le32_to_cpu(HDR(new_bh)->h_refcount)); | 651 | le32_to_cpu(HDR(new_bh)->h_refcount)); |
653 | } | 652 | } |
@@ -660,10 +659,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
660 | ext2_xattr_cache_insert(new_bh); | 659 | ext2_xattr_cache_insert(new_bh); |
661 | } else { | 660 | } else { |
662 | /* We need to allocate a new block */ | 661 | /* We need to allocate a new block */ |
663 | int goal = le32_to_cpu(EXT2_SB(sb)->s_es-> | 662 | ext2_fsblk_t goal = ext2_group_first_block_no(sb, |
664 | s_first_data_block) + | 663 | EXT2_I(inode)->i_block_group); |
665 | EXT2_I(inode)->i_block_group * | ||
666 | EXT2_BLOCKS_PER_GROUP(sb); | ||
667 | int block = ext2_new_block(inode, goal, &error); | 664 | int block = ext2_new_block(inode, goal, &error); |
668 | if (error) | 665 | if (error) |
669 | goto cleanup; | 666 | goto cleanup; |
@@ -731,8 +728,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
731 | bforget(old_bh); | 728 | bforget(old_bh); |
732 | } else { | 729 | } else { |
733 | /* Decrement the refcount only. */ | 730 | /* Decrement the refcount only. */ |
734 | HDR(old_bh)->h_refcount = cpu_to_le32( | 731 | le32_add_cpu(&HDR(old_bh)->h_refcount, -1); |
735 | le32_to_cpu(HDR(old_bh)->h_refcount) - 1); | ||
736 | if (ce) | 732 | if (ce) |
737 | mb_cache_entry_release(ce); | 733 | mb_cache_entry_release(ce); |
738 | DQUOT_FREE_BLOCK(inode, 1); | 734 | DQUOT_FREE_BLOCK(inode, 1); |
@@ -789,8 +785,7 @@ ext2_xattr_delete_inode(struct inode *inode) | |||
789 | bforget(bh); | 785 | bforget(bh); |
790 | unlock_buffer(bh); | 786 | unlock_buffer(bh); |
791 | } else { | 787 | } else { |
792 | HDR(bh)->h_refcount = cpu_to_le32( | 788 | le32_add_cpu(&HDR(bh)->h_refcount, -1); |
793 | le32_to_cpu(HDR(bh)->h_refcount) - 1); | ||
794 | if (ce) | 789 | if (ce) |
795 | mb_cache_entry_release(ce); | 790 | mb_cache_entry_release(ce); |
796 | ea_bdebug(bh, "refcount now=%d", | 791 | ea_bdebug(bh, "refcount now=%d", |
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c index ca7f00312388..4fb94c20041b 100644 --- a/fs/ext2/xip.c +++ b/fs/ext2/xip.c | |||
@@ -15,24 +15,28 @@ | |||
15 | #include "xip.h" | 15 | #include "xip.h" |
16 | 16 | ||
17 | static inline int | 17 | static inline int |
18 | __inode_direct_access(struct inode *inode, sector_t sector, | 18 | __inode_direct_access(struct inode *inode, sector_t block, |
19 | unsigned long *data) | 19 | void **kaddr, unsigned long *pfn) |
20 | { | 20 | { |
21 | BUG_ON(!inode->i_sb->s_bdev->bd_disk->fops->direct_access); | 21 | struct block_device *bdev = inode->i_sb->s_bdev; |
22 | return inode->i_sb->s_bdev->bd_disk->fops | 22 | struct block_device_operations *ops = bdev->bd_disk->fops; |
23 | ->direct_access(inode->i_sb->s_bdev,sector,data); | 23 | sector_t sector; |
24 | |||
25 | sector = block * (PAGE_SIZE / 512); /* ext2 block to bdev sector */ | ||
26 | |||
27 | BUG_ON(!ops->direct_access); | ||
28 | return ops->direct_access(bdev, sector, kaddr, pfn); | ||
24 | } | 29 | } |
25 | 30 | ||
26 | static inline int | 31 | static inline int |
27 | __ext2_get_sector(struct inode *inode, sector_t offset, int create, | 32 | __ext2_get_block(struct inode *inode, pgoff_t pgoff, int create, |
28 | sector_t *result) | 33 | sector_t *result) |
29 | { | 34 | { |
30 | struct buffer_head tmp; | 35 | struct buffer_head tmp; |
31 | int rc; | 36 | int rc; |
32 | 37 | ||
33 | memset(&tmp, 0, sizeof(struct buffer_head)); | 38 | memset(&tmp, 0, sizeof(struct buffer_head)); |
34 | rc = ext2_get_block(inode, offset/ (PAGE_SIZE/512), &tmp, | 39 | rc = ext2_get_block(inode, pgoff, &tmp, create); |
35 | create); | ||
36 | *result = tmp.b_blocknr; | 40 | *result = tmp.b_blocknr; |
37 | 41 | ||
38 | /* did we get a sparse block (hole in the file)? */ | 42 | /* did we get a sparse block (hole in the file)? */ |
@@ -45,15 +49,15 @@ __ext2_get_sector(struct inode *inode, sector_t offset, int create, | |||
45 | } | 49 | } |
46 | 50 | ||
47 | int | 51 | int |
48 | ext2_clear_xip_target(struct inode *inode, int block) | 52 | ext2_clear_xip_target(struct inode *inode, sector_t block) |
49 | { | 53 | { |
50 | sector_t sector = block * (PAGE_SIZE/512); | 54 | void *kaddr; |
51 | unsigned long data; | 55 | unsigned long pfn; |
52 | int rc; | 56 | int rc; |
53 | 57 | ||
54 | rc = __inode_direct_access(inode, sector, &data); | 58 | rc = __inode_direct_access(inode, block, &kaddr, &pfn); |
55 | if (!rc) | 59 | if (!rc) |
56 | clear_page((void*)data); | 60 | clear_page(kaddr); |
57 | return rc; | 61 | return rc; |
58 | } | 62 | } |
59 | 63 | ||
@@ -64,30 +68,23 @@ void ext2_xip_verify_sb(struct super_block *sb) | |||
64 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP) && | 68 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP) && |
65 | !sb->s_bdev->bd_disk->fops->direct_access) { | 69 | !sb->s_bdev->bd_disk->fops->direct_access) { |
66 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); | 70 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); |
67 | ext2_warning(sb, __FUNCTION__, | 71 | ext2_warning(sb, __func__, |
68 | "ignoring xip option - not supported by bdev"); | 72 | "ignoring xip option - not supported by bdev"); |
69 | } | 73 | } |
70 | } | 74 | } |
71 | 75 | ||
72 | struct page * | 76 | int ext2_get_xip_mem(struct address_space *mapping, pgoff_t pgoff, int create, |
73 | ext2_get_xip_page(struct address_space *mapping, sector_t offset, | 77 | void **kmem, unsigned long *pfn) |
74 | int create) | ||
75 | { | 78 | { |
76 | int rc; | 79 | int rc; |
77 | unsigned long data; | 80 | sector_t block; |
78 | sector_t sector; | ||
79 | 81 | ||
80 | /* first, retrieve the sector number */ | 82 | /* first, retrieve the sector number */ |
81 | rc = __ext2_get_sector(mapping->host, offset, create, §or); | 83 | rc = __ext2_get_block(mapping->host, pgoff, create, &block); |
82 | if (rc) | 84 | if (rc) |
83 | goto error; | 85 | return rc; |
84 | 86 | ||
85 | /* retrieve address of the target data */ | 87 | /* retrieve address of the target data */ |
86 | rc = __inode_direct_access | 88 | rc = __inode_direct_access(mapping->host, block, kmem, pfn); |
87 | (mapping->host, sector * (PAGE_SIZE/512), &data); | 89 | return rc; |
88 | if (!rc) | ||
89 | return virt_to_page(data); | ||
90 | |||
91 | error: | ||
92 | return ERR_PTR(rc); | ||
93 | } | 90 | } |
diff --git a/fs/ext2/xip.h b/fs/ext2/xip.h index aa85331d6c56..18b34d2f31b3 100644 --- a/fs/ext2/xip.h +++ b/fs/ext2/xip.h | |||
@@ -7,19 +7,20 @@ | |||
7 | 7 | ||
8 | #ifdef CONFIG_EXT2_FS_XIP | 8 | #ifdef CONFIG_EXT2_FS_XIP |
9 | extern void ext2_xip_verify_sb (struct super_block *); | 9 | extern void ext2_xip_verify_sb (struct super_block *); |
10 | extern int ext2_clear_xip_target (struct inode *, int); | 10 | extern int ext2_clear_xip_target (struct inode *, sector_t); |
11 | 11 | ||
12 | static inline int ext2_use_xip (struct super_block *sb) | 12 | static inline int ext2_use_xip (struct super_block *sb) |
13 | { | 13 | { |
14 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 14 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
15 | return (sbi->s_mount_opt & EXT2_MOUNT_XIP); | 15 | return (sbi->s_mount_opt & EXT2_MOUNT_XIP); |
16 | } | 16 | } |
17 | struct page* ext2_get_xip_page (struct address_space *, sector_t, int); | 17 | int ext2_get_xip_mem(struct address_space *, pgoff_t, int, |
18 | #define mapping_is_xip(map) unlikely(map->a_ops->get_xip_page) | 18 | void **, unsigned long *); |
19 | #define mapping_is_xip(map) unlikely(map->a_ops->get_xip_mem) | ||
19 | #else | 20 | #else |
20 | #define mapping_is_xip(map) 0 | 21 | #define mapping_is_xip(map) 0 |
21 | #define ext2_xip_verify_sb(sb) do { } while (0) | 22 | #define ext2_xip_verify_sb(sb) do { } while (0) |
22 | #define ext2_use_xip(sb) 0 | 23 | #define ext2_use_xip(sb) 0 |
23 | #define ext2_clear_xip_target(inode, chain) 0 | 24 | #define ext2_clear_xip_target(inode, chain) 0 |
24 | #define ext2_get_xip_page NULL | 25 | #define ext2_get_xip_mem NULL |
25 | #endif | 26 | #endif |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index da0cb2c0e437..92fd0338a6eb 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -117,7 +117,7 @@ static int ext3_valid_block_bitmap(struct super_block *sb, | |||
117 | return 1; | 117 | return 1; |
118 | 118 | ||
119 | err_out: | 119 | err_out: |
120 | ext3_error(sb, __FUNCTION__, | 120 | ext3_error(sb, __func__, |
121 | "Invalid block bitmap - " | 121 | "Invalid block bitmap - " |
122 | "block_group = %d, block = %lu", | 122 | "block_group = %d, block = %lu", |
123 | block_group, bitmap_blk); | 123 | block_group, bitmap_blk); |
@@ -147,7 +147,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
147 | bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); | 147 | bitmap_blk = le32_to_cpu(desc->bg_block_bitmap); |
148 | bh = sb_getblk(sb, bitmap_blk); | 148 | bh = sb_getblk(sb, bitmap_blk); |
149 | if (unlikely(!bh)) { | 149 | if (unlikely(!bh)) { |
150 | ext3_error(sb, __FUNCTION__, | 150 | ext3_error(sb, __func__, |
151 | "Cannot read block bitmap - " | 151 | "Cannot read block bitmap - " |
152 | "block_group = %d, block_bitmap = %u", | 152 | "block_group = %d, block_bitmap = %u", |
153 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 153 | block_group, le32_to_cpu(desc->bg_block_bitmap)); |
@@ -158,16 +158,17 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
158 | 158 | ||
159 | if (bh_submit_read(bh) < 0) { | 159 | if (bh_submit_read(bh) < 0) { |
160 | brelse(bh); | 160 | brelse(bh); |
161 | ext3_error(sb, __FUNCTION__, | 161 | ext3_error(sb, __func__, |
162 | "Cannot read block bitmap - " | 162 | "Cannot read block bitmap - " |
163 | "block_group = %d, block_bitmap = %u", | 163 | "block_group = %d, block_bitmap = %u", |
164 | block_group, le32_to_cpu(desc->bg_block_bitmap)); | 164 | block_group, le32_to_cpu(desc->bg_block_bitmap)); |
165 | return NULL; | 165 | return NULL; |
166 | } | 166 | } |
167 | if (!ext3_valid_block_bitmap(sb, desc, block_group, bh)) { | 167 | ext3_valid_block_bitmap(sb, desc, block_group, bh); |
168 | brelse(bh); | 168 | /* |
169 | return NULL; | 169 | * file system mounted not to panic on error, continue with corrupt |
170 | } | 170 | * bitmap |
171 | */ | ||
171 | return bh; | 172 | return bh; |
172 | } | 173 | } |
173 | /* | 174 | /* |
@@ -232,11 +233,10 @@ restart: | |||
232 | prev = rsv; | 233 | prev = rsv; |
233 | } | 234 | } |
234 | printk("Window map complete.\n"); | 235 | printk("Window map complete.\n"); |
235 | if (bad) | 236 | BUG_ON(bad); |
236 | BUG(); | ||
237 | } | 237 | } |
238 | #define rsv_window_dump(root, verbose) \ | 238 | #define rsv_window_dump(root, verbose) \ |
239 | __rsv_window_dump((root), (verbose), __FUNCTION__) | 239 | __rsv_window_dump((root), (verbose), __func__) |
240 | #else | 240 | #else |
241 | #define rsv_window_dump(root, verbose) do {} while (0) | 241 | #define rsv_window_dump(root, verbose) do {} while (0) |
242 | #endif | 242 | #endif |
@@ -618,7 +618,7 @@ do_more: | |||
618 | if (!ext3_clear_bit_atomic(sb_bgl_lock(sbi, block_group), | 618 | if (!ext3_clear_bit_atomic(sb_bgl_lock(sbi, block_group), |
619 | bit + i, bitmap_bh->b_data)) { | 619 | bit + i, bitmap_bh->b_data)) { |
620 | jbd_unlock_bh_state(bitmap_bh); | 620 | jbd_unlock_bh_state(bitmap_bh); |
621 | ext3_error(sb, __FUNCTION__, | 621 | ext3_error(sb, __func__, |
622 | "bit already cleared for block "E3FSBLK, | 622 | "bit already cleared for block "E3FSBLK, |
623 | block + i); | 623 | block + i); |
624 | jbd_lock_bh_state(bitmap_bh); | 624 | jbd_lock_bh_state(bitmap_bh); |
@@ -1642,7 +1642,11 @@ allocated: | |||
1642 | "Allocating block in system zone - " | 1642 | "Allocating block in system zone - " |
1643 | "blocks from "E3FSBLK", length %lu", | 1643 | "blocks from "E3FSBLK", length %lu", |
1644 | ret_block, num); | 1644 | ret_block, num); |
1645 | goto out; | 1645 | /* |
1646 | * claim_block() marked the blocks we allocated as in use. So we | ||
1647 | * may want to selectively mark some of the blocks as free. | ||
1648 | */ | ||
1649 | goto retry_alloc; | ||
1646 | } | 1650 | } |
1647 | 1651 | ||
1648 | performed_allocation = 1; | 1652 | performed_allocation = 1; |
@@ -1668,7 +1672,7 @@ allocated: | |||
1668 | if (ext3_test_bit(grp_alloc_blk+i, | 1672 | if (ext3_test_bit(grp_alloc_blk+i, |
1669 | bh2jh(bitmap_bh)->b_committed_data)) { | 1673 | bh2jh(bitmap_bh)->b_committed_data)) { |
1670 | printk("%s: block was unexpectedly set in " | 1674 | printk("%s: block was unexpectedly set in " |
1671 | "b_committed_data\n", __FUNCTION__); | 1675 | "b_committed_data\n", __func__); |
1672 | } | 1676 | } |
1673 | } | 1677 | } |
1674 | } | 1678 | } |
diff --git a/fs/ext3/ext3_jbd.c b/fs/ext3/ext3_jbd.c index e1f91fd26a93..d401f148d74d 100644 --- a/fs/ext3/ext3_jbd.c +++ b/fs/ext3/ext3_jbd.c | |||
@@ -9,7 +9,7 @@ int __ext3_journal_get_undo_access(const char *where, handle_t *handle, | |||
9 | { | 9 | { |
10 | int err = journal_get_undo_access(handle, bh); | 10 | int err = journal_get_undo_access(handle, bh); |
11 | if (err) | 11 | if (err) |
12 | ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | 12 | ext3_journal_abort_handle(where, __func__, bh, handle,err); |
13 | return err; | 13 | return err; |
14 | } | 14 | } |
15 | 15 | ||
@@ -18,7 +18,7 @@ int __ext3_journal_get_write_access(const char *where, handle_t *handle, | |||
18 | { | 18 | { |
19 | int err = journal_get_write_access(handle, bh); | 19 | int err = journal_get_write_access(handle, bh); |
20 | if (err) | 20 | if (err) |
21 | ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | 21 | ext3_journal_abort_handle(where, __func__, bh, handle,err); |
22 | return err; | 22 | return err; |
23 | } | 23 | } |
24 | 24 | ||
@@ -27,7 +27,7 @@ int __ext3_journal_forget(const char *where, handle_t *handle, | |||
27 | { | 27 | { |
28 | int err = journal_forget(handle, bh); | 28 | int err = journal_forget(handle, bh); |
29 | if (err) | 29 | if (err) |
30 | ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | 30 | ext3_journal_abort_handle(where, __func__, bh, handle,err); |
31 | return err; | 31 | return err; |
32 | } | 32 | } |
33 | 33 | ||
@@ -36,7 +36,7 @@ int __ext3_journal_revoke(const char *where, handle_t *handle, | |||
36 | { | 36 | { |
37 | int err = journal_revoke(handle, blocknr, bh); | 37 | int err = journal_revoke(handle, blocknr, bh); |
38 | if (err) | 38 | if (err) |
39 | ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | 39 | ext3_journal_abort_handle(where, __func__, bh, handle,err); |
40 | return err; | 40 | return err; |
41 | } | 41 | } |
42 | 42 | ||
@@ -45,7 +45,7 @@ int __ext3_journal_get_create_access(const char *where, | |||
45 | { | 45 | { |
46 | int err = journal_get_create_access(handle, bh); | 46 | int err = journal_get_create_access(handle, bh); |
47 | if (err) | 47 | if (err) |
48 | ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | 48 | ext3_journal_abort_handle(where, __func__, bh, handle,err); |
49 | return err; | 49 | return err; |
50 | } | 50 | } |
51 | 51 | ||
@@ -54,6 +54,6 @@ int __ext3_journal_dirty_metadata(const char *where, | |||
54 | { | 54 | { |
55 | int err = journal_dirty_metadata(handle, bh); | 55 | int err = journal_dirty_metadata(handle, bh); |
56 | if (err) | 56 | if (err) |
57 | ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err); | 57 | ext3_journal_abort_handle(where, __func__, bh, handle,err); |
58 | return err; | 58 | return err; |
59 | } | 59 | } |
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index a588e23841d4..d33634119e17 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c | |||
@@ -72,6 +72,9 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) | |||
72 | goto out; | 72 | goto out; |
73 | } | 73 | } |
74 | 74 | ||
75 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) | ||
76 | goto out; | ||
77 | |||
75 | /* | 78 | /* |
76 | * The VFS has written the file data. If the inode is unaltered | 79 | * The VFS has written the file data. If the inode is unaltered |
77 | * then we need not start a commit. | 80 | * then we need not start a commit. |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 96dd5573e49b..77126821b2e9 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -644,7 +644,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino) | |||
644 | 644 | ||
645 | /* Error cases - e2fsck has already cleaned up for us */ | 645 | /* Error cases - e2fsck has already cleaned up for us */ |
646 | if (ino > max_ino) { | 646 | if (ino > max_ino) { |
647 | ext3_warning(sb, __FUNCTION__, | 647 | ext3_warning(sb, __func__, |
648 | "bad orphan ino %lu! e2fsck was run?", ino); | 648 | "bad orphan ino %lu! e2fsck was run?", ino); |
649 | goto error; | 649 | goto error; |
650 | } | 650 | } |
@@ -653,7 +653,7 @@ struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino) | |||
653 | bit = (ino - 1) % EXT3_INODES_PER_GROUP(sb); | 653 | bit = (ino - 1) % EXT3_INODES_PER_GROUP(sb); |
654 | bitmap_bh = read_inode_bitmap(sb, block_group); | 654 | bitmap_bh = read_inode_bitmap(sb, block_group); |
655 | if (!bitmap_bh) { | 655 | if (!bitmap_bh) { |
656 | ext3_warning(sb, __FUNCTION__, | 656 | ext3_warning(sb, __func__, |
657 | "inode bitmap error for orphan %lu", ino); | 657 | "inode bitmap error for orphan %lu", ino); |
658 | goto error; | 658 | goto error; |
659 | } | 659 | } |
@@ -678,7 +678,7 @@ iget_failed: | |||
678 | err = PTR_ERR(inode); | 678 | err = PTR_ERR(inode); |
679 | inode = NULL; | 679 | inode = NULL; |
680 | bad_orphan: | 680 | bad_orphan: |
681 | ext3_warning(sb, __FUNCTION__, | 681 | ext3_warning(sb, __func__, |
682 | "bad orphan inode %lu! e2fsck was run?", ino); | 682 | "bad orphan inode %lu! e2fsck was run?", ino); |
683 | printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n", | 683 | printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n", |
684 | bit, (unsigned long long)bitmap_bh->b_blocknr, | 684 | bit, (unsigned long long)bitmap_bh->b_blocknr, |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index c683609b0e3a..cc47b76091bf 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -95,7 +95,7 @@ int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, | |||
95 | BUFFER_TRACE(bh, "call ext3_journal_revoke"); | 95 | BUFFER_TRACE(bh, "call ext3_journal_revoke"); |
96 | err = ext3_journal_revoke(handle, blocknr, bh); | 96 | err = ext3_journal_revoke(handle, blocknr, bh); |
97 | if (err) | 97 | if (err) |
98 | ext3_abort(inode->i_sb, __FUNCTION__, | 98 | ext3_abort(inode->i_sb, __func__, |
99 | "error %d when attempting revoke", err); | 99 | "error %d when attempting revoke", err); |
100 | BUFFER_TRACE(bh, "exit"); | 100 | BUFFER_TRACE(bh, "exit"); |
101 | return err; | 101 | return err; |
@@ -1190,7 +1190,7 @@ int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh) | |||
1190 | { | 1190 | { |
1191 | int err = journal_dirty_data(handle, bh); | 1191 | int err = journal_dirty_data(handle, bh); |
1192 | if (err) | 1192 | if (err) |
1193 | ext3_journal_abort_handle(__FUNCTION__, __FUNCTION__, | 1193 | ext3_journal_abort_handle(__func__, __func__, |
1194 | bh, handle, err); | 1194 | bh, handle, err); |
1195 | return err; | 1195 | return err; |
1196 | } | 1196 | } |
@@ -2454,11 +2454,10 @@ out_stop: | |||
2454 | static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, | 2454 | static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, |
2455 | unsigned long ino, struct ext3_iloc *iloc) | 2455 | unsigned long ino, struct ext3_iloc *iloc) |
2456 | { | 2456 | { |
2457 | unsigned long desc, group_desc, block_group; | 2457 | unsigned long block_group; |
2458 | unsigned long offset; | 2458 | unsigned long offset; |
2459 | ext3_fsblk_t block; | 2459 | ext3_fsblk_t block; |
2460 | struct buffer_head *bh; | 2460 | struct ext3_group_desc *gdp; |
2461 | struct ext3_group_desc * gdp; | ||
2462 | 2461 | ||
2463 | if (!ext3_valid_inum(sb, ino)) { | 2462 | if (!ext3_valid_inum(sb, ino)) { |
2464 | /* | 2463 | /* |
@@ -2470,27 +2469,15 @@ static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, | |||
2470 | } | 2469 | } |
2471 | 2470 | ||
2472 | block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); | 2471 | block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); |
2473 | if (block_group >= EXT3_SB(sb)->s_groups_count) { | 2472 | gdp = ext3_get_group_desc(sb, block_group, NULL); |
2474 | ext3_error(sb,"ext3_get_inode_block","group >= groups count"); | 2473 | if (!gdp) |
2475 | return 0; | ||
2476 | } | ||
2477 | smp_rmb(); | ||
2478 | group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(sb); | ||
2479 | desc = block_group & (EXT3_DESC_PER_BLOCK(sb) - 1); | ||
2480 | bh = EXT3_SB(sb)->s_group_desc[group_desc]; | ||
2481 | if (!bh) { | ||
2482 | ext3_error (sb, "ext3_get_inode_block", | ||
2483 | "Descriptor not loaded"); | ||
2484 | return 0; | 2474 | return 0; |
2485 | } | ||
2486 | |||
2487 | gdp = (struct ext3_group_desc *)bh->b_data; | ||
2488 | /* | 2475 | /* |
2489 | * Figure out the offset within the block group inode table | 2476 | * Figure out the offset within the block group inode table |
2490 | */ | 2477 | */ |
2491 | offset = ((ino - 1) % EXT3_INODES_PER_GROUP(sb)) * | 2478 | offset = ((ino - 1) % EXT3_INODES_PER_GROUP(sb)) * |
2492 | EXT3_INODE_SIZE(sb); | 2479 | EXT3_INODE_SIZE(sb); |
2493 | block = le32_to_cpu(gdp[desc].bg_inode_table) + | 2480 | block = le32_to_cpu(gdp->bg_inode_table) + |
2494 | (offset >> EXT3_BLOCK_SIZE_BITS(sb)); | 2481 | (offset >> EXT3_BLOCK_SIZE_BITS(sb)); |
2495 | 2482 | ||
2496 | iloc->block_group = block_group; | 2483 | iloc->block_group = block_group; |
@@ -3214,7 +3201,7 @@ void ext3_dirty_inode(struct inode *inode) | |||
3214 | current_handle->h_transaction != handle->h_transaction) { | 3201 | current_handle->h_transaction != handle->h_transaction) { |
3215 | /* This task has a transaction open against a different fs */ | 3202 | /* This task has a transaction open against a different fs */ |
3216 | printk(KERN_EMERG "%s: transactions do not match!\n", | 3203 | printk(KERN_EMERG "%s: transactions do not match!\n", |
3217 | __FUNCTION__); | 3204 | __func__); |
3218 | } else { | 3205 | } else { |
3219 | jbd_debug(5, "marking dirty. outer handle=%p\n", | 3206 | jbd_debug(5, "marking dirty. outer handle=%p\n", |
3220 | current_handle); | 3207 | current_handle); |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index dec3e0d88ab1..0b8cf80154f1 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -57,10 +57,15 @@ static struct buffer_head *ext3_append(handle_t *handle, | |||
57 | 57 | ||
58 | *block = inode->i_size >> inode->i_sb->s_blocksize_bits; | 58 | *block = inode->i_size >> inode->i_sb->s_blocksize_bits; |
59 | 59 | ||
60 | if ((bh = ext3_bread(handle, inode, *block, 1, err))) { | 60 | bh = ext3_bread(handle, inode, *block, 1, err); |
61 | if (bh) { | ||
61 | inode->i_size += inode->i_sb->s_blocksize; | 62 | inode->i_size += inode->i_sb->s_blocksize; |
62 | EXT3_I(inode)->i_disksize = inode->i_size; | 63 | EXT3_I(inode)->i_disksize = inode->i_size; |
63 | ext3_journal_get_write_access(handle,bh); | 64 | *err = ext3_journal_get_write_access(handle, bh); |
65 | if (*err) { | ||
66 | brelse(bh); | ||
67 | bh = NULL; | ||
68 | } | ||
64 | } | 69 | } |
65 | return bh; | 70 | return bh; |
66 | } | 71 | } |
@@ -356,7 +361,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
356 | if (root->info.hash_version != DX_HASH_TEA && | 361 | if (root->info.hash_version != DX_HASH_TEA && |
357 | root->info.hash_version != DX_HASH_HALF_MD4 && | 362 | root->info.hash_version != DX_HASH_HALF_MD4 && |
358 | root->info.hash_version != DX_HASH_LEGACY) { | 363 | root->info.hash_version != DX_HASH_LEGACY) { |
359 | ext3_warning(dir->i_sb, __FUNCTION__, | 364 | ext3_warning(dir->i_sb, __func__, |
360 | "Unrecognised inode hash code %d", | 365 | "Unrecognised inode hash code %d", |
361 | root->info.hash_version); | 366 | root->info.hash_version); |
362 | brelse(bh); | 367 | brelse(bh); |
@@ -370,7 +375,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
370 | hash = hinfo->hash; | 375 | hash = hinfo->hash; |
371 | 376 | ||
372 | if (root->info.unused_flags & 1) { | 377 | if (root->info.unused_flags & 1) { |
373 | ext3_warning(dir->i_sb, __FUNCTION__, | 378 | ext3_warning(dir->i_sb, __func__, |
374 | "Unimplemented inode hash flags: %#06x", | 379 | "Unimplemented inode hash flags: %#06x", |
375 | root->info.unused_flags); | 380 | root->info.unused_flags); |
376 | brelse(bh); | 381 | brelse(bh); |
@@ -379,7 +384,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
379 | } | 384 | } |
380 | 385 | ||
381 | if ((indirect = root->info.indirect_levels) > 1) { | 386 | if ((indirect = root->info.indirect_levels) > 1) { |
382 | ext3_warning(dir->i_sb, __FUNCTION__, | 387 | ext3_warning(dir->i_sb, __func__, |
383 | "Unimplemented inode hash depth: %#06x", | 388 | "Unimplemented inode hash depth: %#06x", |
384 | root->info.indirect_levels); | 389 | root->info.indirect_levels); |
385 | brelse(bh); | 390 | brelse(bh); |
@@ -392,7 +397,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
392 | 397 | ||
393 | if (dx_get_limit(entries) != dx_root_limit(dir, | 398 | if (dx_get_limit(entries) != dx_root_limit(dir, |
394 | root->info.info_length)) { | 399 | root->info.info_length)) { |
395 | ext3_warning(dir->i_sb, __FUNCTION__, | 400 | ext3_warning(dir->i_sb, __func__, |
396 | "dx entry: limit != root limit"); | 401 | "dx entry: limit != root limit"); |
397 | brelse(bh); | 402 | brelse(bh); |
398 | *err = ERR_BAD_DX_DIR; | 403 | *err = ERR_BAD_DX_DIR; |
@@ -404,7 +409,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
404 | { | 409 | { |
405 | count = dx_get_count(entries); | 410 | count = dx_get_count(entries); |
406 | if (!count || count > dx_get_limit(entries)) { | 411 | if (!count || count > dx_get_limit(entries)) { |
407 | ext3_warning(dir->i_sb, __FUNCTION__, | 412 | ext3_warning(dir->i_sb, __func__, |
408 | "dx entry: no count or count > limit"); | 413 | "dx entry: no count or count > limit"); |
409 | brelse(bh); | 414 | brelse(bh); |
410 | *err = ERR_BAD_DX_DIR; | 415 | *err = ERR_BAD_DX_DIR; |
@@ -449,7 +454,7 @@ dx_probe(struct dentry *dentry, struct inode *dir, | |||
449 | goto fail2; | 454 | goto fail2; |
450 | at = entries = ((struct dx_node *) bh->b_data)->entries; | 455 | at = entries = ((struct dx_node *) bh->b_data)->entries; |
451 | if (dx_get_limit(entries) != dx_node_limit (dir)) { | 456 | if (dx_get_limit(entries) != dx_node_limit (dir)) { |
452 | ext3_warning(dir->i_sb, __FUNCTION__, | 457 | ext3_warning(dir->i_sb, __func__, |
453 | "dx entry: limit != node limit"); | 458 | "dx entry: limit != node limit"); |
454 | brelse(bh); | 459 | brelse(bh); |
455 | *err = ERR_BAD_DX_DIR; | 460 | *err = ERR_BAD_DX_DIR; |
@@ -465,7 +470,7 @@ fail2: | |||
465 | } | 470 | } |
466 | fail: | 471 | fail: |
467 | if (*err == ERR_BAD_DX_DIR) | 472 | if (*err == ERR_BAD_DX_DIR) |
468 | ext3_warning(dir->i_sb, __FUNCTION__, | 473 | ext3_warning(dir->i_sb, __func__, |
469 | "Corrupt dir inode %ld, running e2fsck is " | 474 | "Corrupt dir inode %ld, running e2fsck is " |
470 | "recommended.", dir->i_ino); | 475 | "recommended.", dir->i_ino); |
471 | return NULL; | 476 | return NULL; |
@@ -913,7 +918,7 @@ restart: | |||
913 | wait_on_buffer(bh); | 918 | wait_on_buffer(bh); |
914 | if (!buffer_uptodate(bh)) { | 919 | if (!buffer_uptodate(bh)) { |
915 | /* read error, skip block & hope for the best */ | 920 | /* read error, skip block & hope for the best */ |
916 | ext3_error(sb, __FUNCTION__, "reading directory #%lu " | 921 | ext3_error(sb, __func__, "reading directory #%lu " |
917 | "offset %lu", dir->i_ino, block); | 922 | "offset %lu", dir->i_ino, block); |
918 | brelse(bh); | 923 | brelse(bh); |
919 | goto next; | 924 | goto next; |
@@ -1005,7 +1010,7 @@ static struct buffer_head * ext3_dx_find_entry(struct dentry *dentry, | |||
1005 | retval = ext3_htree_next_block(dir, hash, frame, | 1010 | retval = ext3_htree_next_block(dir, hash, frame, |
1006 | frames, NULL); | 1011 | frames, NULL); |
1007 | if (retval < 0) { | 1012 | if (retval < 0) { |
1008 | ext3_warning(sb, __FUNCTION__, | 1013 | ext3_warning(sb, __func__, |
1009 | "error reading index page in directory #%lu", | 1014 | "error reading index page in directory #%lu", |
1010 | dir->i_ino); | 1015 | dir->i_ino); |
1011 | *err = retval; | 1016 | *err = retval; |
@@ -1530,7 +1535,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
1530 | 1535 | ||
1531 | if (levels && (dx_get_count(frames->entries) == | 1536 | if (levels && (dx_get_count(frames->entries) == |
1532 | dx_get_limit(frames->entries))) { | 1537 | dx_get_limit(frames->entries))) { |
1533 | ext3_warning(sb, __FUNCTION__, | 1538 | ext3_warning(sb, __func__, |
1534 | "Directory index full!"); | 1539 | "Directory index full!"); |
1535 | err = -ENOSPC; | 1540 | err = -ENOSPC; |
1536 | goto cleanup; | 1541 | goto cleanup; |
@@ -1832,11 +1837,11 @@ static int empty_dir (struct inode * inode) | |||
1832 | if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) || | 1837 | if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) || |
1833 | !(bh = ext3_bread (NULL, inode, 0, 0, &err))) { | 1838 | !(bh = ext3_bread (NULL, inode, 0, 0, &err))) { |
1834 | if (err) | 1839 | if (err) |
1835 | ext3_error(inode->i_sb, __FUNCTION__, | 1840 | ext3_error(inode->i_sb, __func__, |
1836 | "error %d reading directory #%lu offset 0", | 1841 | "error %d reading directory #%lu offset 0", |
1837 | err, inode->i_ino); | 1842 | err, inode->i_ino); |
1838 | else | 1843 | else |
1839 | ext3_warning(inode->i_sb, __FUNCTION__, | 1844 | ext3_warning(inode->i_sb, __func__, |
1840 | "bad directory (dir #%lu) - no data block", | 1845 | "bad directory (dir #%lu) - no data block", |
1841 | inode->i_ino); | 1846 | inode->i_ino); |
1842 | return 1; | 1847 | return 1; |
@@ -1865,7 +1870,7 @@ static int empty_dir (struct inode * inode) | |||
1865 | offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err); | 1870 | offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err); |
1866 | if (!bh) { | 1871 | if (!bh) { |
1867 | if (err) | 1872 | if (err) |
1868 | ext3_error(sb, __FUNCTION__, | 1873 | ext3_error(sb, __func__, |
1869 | "error %d reading directory" | 1874 | "error %d reading directory" |
1870 | " #%lu offset %lu", | 1875 | " #%lu offset %lu", |
1871 | err, inode->i_ino, offset); | 1876 | err, inode->i_ino, offset); |
@@ -2318,6 +2323,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2318 | EXT3_FEATURE_INCOMPAT_FILETYPE)) | 2323 | EXT3_FEATURE_INCOMPAT_FILETYPE)) |
2319 | new_de->file_type = old_de->file_type; | 2324 | new_de->file_type = old_de->file_type; |
2320 | new_dir->i_version++; | 2325 | new_dir->i_version++; |
2326 | new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME_SEC; | ||
2327 | ext3_mark_inode_dirty(handle, new_dir); | ||
2321 | BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); | 2328 | BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); |
2322 | ext3_journal_dirty_metadata(handle, new_bh); | 2329 | ext3_journal_dirty_metadata(handle, new_bh); |
2323 | brelse(new_bh); | 2330 | brelse(new_bh); |
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 0e97b6e07cb0..28cfd0b40527 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -48,60 +48,60 @@ static int verify_group_input(struct super_block *sb, | |||
48 | free_blocks_count, input->reserved_blocks); | 48 | free_blocks_count, input->reserved_blocks); |
49 | 49 | ||
50 | if (group != sbi->s_groups_count) | 50 | if (group != sbi->s_groups_count) |
51 | ext3_warning(sb, __FUNCTION__, | 51 | ext3_warning(sb, __func__, |
52 | "Cannot add at group %u (only %lu groups)", | 52 | "Cannot add at group %u (only %lu groups)", |
53 | input->group, sbi->s_groups_count); | 53 | input->group, sbi->s_groups_count); |
54 | else if ((start - le32_to_cpu(es->s_first_data_block)) % | 54 | else if ((start - le32_to_cpu(es->s_first_data_block)) % |
55 | EXT3_BLOCKS_PER_GROUP(sb)) | 55 | EXT3_BLOCKS_PER_GROUP(sb)) |
56 | ext3_warning(sb, __FUNCTION__, "Last group not full"); | 56 | ext3_warning(sb, __func__, "Last group not full"); |
57 | else if (input->reserved_blocks > input->blocks_count / 5) | 57 | else if (input->reserved_blocks > input->blocks_count / 5) |
58 | ext3_warning(sb, __FUNCTION__, "Reserved blocks too high (%u)", | 58 | ext3_warning(sb, __func__, "Reserved blocks too high (%u)", |
59 | input->reserved_blocks); | 59 | input->reserved_blocks); |
60 | else if (free_blocks_count < 0) | 60 | else if (free_blocks_count < 0) |
61 | ext3_warning(sb, __FUNCTION__, "Bad blocks count %u", | 61 | ext3_warning(sb, __func__, "Bad blocks count %u", |
62 | input->blocks_count); | 62 | input->blocks_count); |
63 | else if (!(bh = sb_bread(sb, end - 1))) | 63 | else if (!(bh = sb_bread(sb, end - 1))) |
64 | ext3_warning(sb, __FUNCTION__, | 64 | ext3_warning(sb, __func__, |
65 | "Cannot read last block ("E3FSBLK")", | 65 | "Cannot read last block ("E3FSBLK")", |
66 | end - 1); | 66 | end - 1); |
67 | else if (outside(input->block_bitmap, start, end)) | 67 | else if (outside(input->block_bitmap, start, end)) |
68 | ext3_warning(sb, __FUNCTION__, | 68 | ext3_warning(sb, __func__, |
69 | "Block bitmap not in group (block %u)", | 69 | "Block bitmap not in group (block %u)", |
70 | input->block_bitmap); | 70 | input->block_bitmap); |
71 | else if (outside(input->inode_bitmap, start, end)) | 71 | else if (outside(input->inode_bitmap, start, end)) |
72 | ext3_warning(sb, __FUNCTION__, | 72 | ext3_warning(sb, __func__, |
73 | "Inode bitmap not in group (block %u)", | 73 | "Inode bitmap not in group (block %u)", |
74 | input->inode_bitmap); | 74 | input->inode_bitmap); |
75 | else if (outside(input->inode_table, start, end) || | 75 | else if (outside(input->inode_table, start, end) || |
76 | outside(itend - 1, start, end)) | 76 | outside(itend - 1, start, end)) |
77 | ext3_warning(sb, __FUNCTION__, | 77 | ext3_warning(sb, __func__, |
78 | "Inode table not in group (blocks %u-"E3FSBLK")", | 78 | "Inode table not in group (blocks %u-"E3FSBLK")", |
79 | input->inode_table, itend - 1); | 79 | input->inode_table, itend - 1); |
80 | else if (input->inode_bitmap == input->block_bitmap) | 80 | else if (input->inode_bitmap == input->block_bitmap) |
81 | ext3_warning(sb, __FUNCTION__, | 81 | ext3_warning(sb, __func__, |
82 | "Block bitmap same as inode bitmap (%u)", | 82 | "Block bitmap same as inode bitmap (%u)", |
83 | input->block_bitmap); | 83 | input->block_bitmap); |
84 | else if (inside(input->block_bitmap, input->inode_table, itend)) | 84 | else if (inside(input->block_bitmap, input->inode_table, itend)) |
85 | ext3_warning(sb, __FUNCTION__, | 85 | ext3_warning(sb, __func__, |
86 | "Block bitmap (%u) in inode table (%u-"E3FSBLK")", | 86 | "Block bitmap (%u) in inode table (%u-"E3FSBLK")", |
87 | input->block_bitmap, input->inode_table, itend-1); | 87 | input->block_bitmap, input->inode_table, itend-1); |
88 | else if (inside(input->inode_bitmap, input->inode_table, itend)) | 88 | else if (inside(input->inode_bitmap, input->inode_table, itend)) |
89 | ext3_warning(sb, __FUNCTION__, | 89 | ext3_warning(sb, __func__, |
90 | "Inode bitmap (%u) in inode table (%u-"E3FSBLK")", | 90 | "Inode bitmap (%u) in inode table (%u-"E3FSBLK")", |
91 | input->inode_bitmap, input->inode_table, itend-1); | 91 | input->inode_bitmap, input->inode_table, itend-1); |
92 | else if (inside(input->block_bitmap, start, metaend)) | 92 | else if (inside(input->block_bitmap, start, metaend)) |
93 | ext3_warning(sb, __FUNCTION__, | 93 | ext3_warning(sb, __func__, |
94 | "Block bitmap (%u) in GDT table" | 94 | "Block bitmap (%u) in GDT table" |
95 | " ("E3FSBLK"-"E3FSBLK")", | 95 | " ("E3FSBLK"-"E3FSBLK")", |
96 | input->block_bitmap, start, metaend - 1); | 96 | input->block_bitmap, start, metaend - 1); |
97 | else if (inside(input->inode_bitmap, start, metaend)) | 97 | else if (inside(input->inode_bitmap, start, metaend)) |
98 | ext3_warning(sb, __FUNCTION__, | 98 | ext3_warning(sb, __func__, |
99 | "Inode bitmap (%u) in GDT table" | 99 | "Inode bitmap (%u) in GDT table" |
100 | " ("E3FSBLK"-"E3FSBLK")", | 100 | " ("E3FSBLK"-"E3FSBLK")", |
101 | input->inode_bitmap, start, metaend - 1); | 101 | input->inode_bitmap, start, metaend - 1); |
102 | else if (inside(input->inode_table, start, metaend) || | 102 | else if (inside(input->inode_table, start, metaend) || |
103 | inside(itend - 1, start, metaend)) | 103 | inside(itend - 1, start, metaend)) |
104 | ext3_warning(sb, __FUNCTION__, | 104 | ext3_warning(sb, __func__, |
105 | "Inode table (%u-"E3FSBLK") overlaps" | 105 | "Inode table (%u-"E3FSBLK") overlaps" |
106 | "GDT table ("E3FSBLK"-"E3FSBLK")", | 106 | "GDT table ("E3FSBLK"-"E3FSBLK")", |
107 | input->inode_table, itend - 1, start, metaend - 1); | 107 | input->inode_table, itend - 1, start, metaend - 1); |
@@ -386,7 +386,7 @@ static int verify_reserved_gdb(struct super_block *sb, | |||
386 | 386 | ||
387 | while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { | 387 | while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { |
388 | if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ | 388 | if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ |
389 | ext3_warning(sb, __FUNCTION__, | 389 | ext3_warning(sb, __func__, |
390 | "reserved GDT "E3FSBLK | 390 | "reserved GDT "E3FSBLK |
391 | " missing grp %d ("E3FSBLK")", | 391 | " missing grp %d ("E3FSBLK")", |
392 | blk, grp, | 392 | blk, grp, |
@@ -440,7 +440,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
440 | */ | 440 | */ |
441 | if (EXT3_SB(sb)->s_sbh->b_blocknr != | 441 | if (EXT3_SB(sb)->s_sbh->b_blocknr != |
442 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) { | 442 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) { |
443 | ext3_warning(sb, __FUNCTION__, | 443 | ext3_warning(sb, __func__, |
444 | "won't resize using backup superblock at %llu", | 444 | "won't resize using backup superblock at %llu", |
445 | (unsigned long long)EXT3_SB(sb)->s_sbh->b_blocknr); | 445 | (unsigned long long)EXT3_SB(sb)->s_sbh->b_blocknr); |
446 | return -EPERM; | 446 | return -EPERM; |
@@ -464,7 +464,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
464 | 464 | ||
465 | data = (__le32 *)dind->b_data; | 465 | data = (__le32 *)dind->b_data; |
466 | if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { | 466 | if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { |
467 | ext3_warning(sb, __FUNCTION__, | 467 | ext3_warning(sb, __func__, |
468 | "new group %u GDT block "E3FSBLK" not reserved", | 468 | "new group %u GDT block "E3FSBLK" not reserved", |
469 | input->group, gdblock); | 469 | input->group, gdblock); |
470 | err = -EINVAL; | 470 | err = -EINVAL; |
@@ -488,7 +488,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
488 | GFP_NOFS); | 488 | GFP_NOFS); |
489 | if (!n_group_desc) { | 489 | if (!n_group_desc) { |
490 | err = -ENOMEM; | 490 | err = -ENOMEM; |
491 | ext3_warning (sb, __FUNCTION__, | 491 | ext3_warning (sb, __func__, |
492 | "not enough memory for %lu groups", gdb_num + 1); | 492 | "not enough memory for %lu groups", gdb_num + 1); |
493 | goto exit_inode; | 493 | goto exit_inode; |
494 | } | 494 | } |
@@ -586,7 +586,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
586 | /* Get each reserved primary GDT block and verify it holds backups */ | 586 | /* Get each reserved primary GDT block and verify it holds backups */ |
587 | for (res = 0; res < reserved_gdb; res++, blk++) { | 587 | for (res = 0; res < reserved_gdb; res++, blk++) { |
588 | if (le32_to_cpu(*data) != blk) { | 588 | if (le32_to_cpu(*data) != blk) { |
589 | ext3_warning(sb, __FUNCTION__, | 589 | ext3_warning(sb, __func__, |
590 | "reserved block "E3FSBLK | 590 | "reserved block "E3FSBLK |
591 | " not at offset %ld", | 591 | " not at offset %ld", |
592 | blk, | 592 | blk, |
@@ -730,7 +730,7 @@ static void update_backups(struct super_block *sb, | |||
730 | */ | 730 | */ |
731 | exit_err: | 731 | exit_err: |
732 | if (err) { | 732 | if (err) { |
733 | ext3_warning(sb, __FUNCTION__, | 733 | ext3_warning(sb, __func__, |
734 | "can't update backup for group %d (err %d), " | 734 | "can't update backup for group %d (err %d), " |
735 | "forcing fsck on next reboot", group, err); | 735 | "forcing fsck on next reboot", group, err); |
736 | sbi->s_mount_state &= ~EXT3_VALID_FS; | 736 | sbi->s_mount_state &= ~EXT3_VALID_FS; |
@@ -770,33 +770,33 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input) | |||
770 | 770 | ||
771 | if (gdb_off == 0 && !EXT3_HAS_RO_COMPAT_FEATURE(sb, | 771 | if (gdb_off == 0 && !EXT3_HAS_RO_COMPAT_FEATURE(sb, |
772 | EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER)) { | 772 | EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER)) { |
773 | ext3_warning(sb, __FUNCTION__, | 773 | ext3_warning(sb, __func__, |
774 | "Can't resize non-sparse filesystem further"); | 774 | "Can't resize non-sparse filesystem further"); |
775 | return -EPERM; | 775 | return -EPERM; |
776 | } | 776 | } |
777 | 777 | ||
778 | if (le32_to_cpu(es->s_blocks_count) + input->blocks_count < | 778 | if (le32_to_cpu(es->s_blocks_count) + input->blocks_count < |
779 | le32_to_cpu(es->s_blocks_count)) { | 779 | le32_to_cpu(es->s_blocks_count)) { |
780 | ext3_warning(sb, __FUNCTION__, "blocks_count overflow\n"); | 780 | ext3_warning(sb, __func__, "blocks_count overflow\n"); |
781 | return -EINVAL; | 781 | return -EINVAL; |
782 | } | 782 | } |
783 | 783 | ||
784 | if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) < | 784 | if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) < |
785 | le32_to_cpu(es->s_inodes_count)) { | 785 | le32_to_cpu(es->s_inodes_count)) { |
786 | ext3_warning(sb, __FUNCTION__, "inodes_count overflow\n"); | 786 | ext3_warning(sb, __func__, "inodes_count overflow\n"); |
787 | return -EINVAL; | 787 | return -EINVAL; |
788 | } | 788 | } |
789 | 789 | ||
790 | if (reserved_gdb || gdb_off == 0) { | 790 | if (reserved_gdb || gdb_off == 0) { |
791 | if (!EXT3_HAS_COMPAT_FEATURE(sb, | 791 | if (!EXT3_HAS_COMPAT_FEATURE(sb, |
792 | EXT3_FEATURE_COMPAT_RESIZE_INODE)){ | 792 | EXT3_FEATURE_COMPAT_RESIZE_INODE)){ |
793 | ext3_warning(sb, __FUNCTION__, | 793 | ext3_warning(sb, __func__, |
794 | "No reserved GDT blocks, can't resize"); | 794 | "No reserved GDT blocks, can't resize"); |
795 | return -EPERM; | 795 | return -EPERM; |
796 | } | 796 | } |
797 | inode = ext3_iget(sb, EXT3_RESIZE_INO); | 797 | inode = ext3_iget(sb, EXT3_RESIZE_INO); |
798 | if (IS_ERR(inode)) { | 798 | if (IS_ERR(inode)) { |
799 | ext3_warning(sb, __FUNCTION__, | 799 | ext3_warning(sb, __func__, |
800 | "Error opening resize inode"); | 800 | "Error opening resize inode"); |
801 | return PTR_ERR(inode); | 801 | return PTR_ERR(inode); |
802 | } | 802 | } |
@@ -825,7 +825,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input) | |||
825 | 825 | ||
826 | lock_super(sb); | 826 | lock_super(sb); |
827 | if (input->group != sbi->s_groups_count) { | 827 | if (input->group != sbi->s_groups_count) { |
828 | ext3_warning(sb, __FUNCTION__, | 828 | ext3_warning(sb, __func__, |
829 | "multiple resizers run on filesystem!"); | 829 | "multiple resizers run on filesystem!"); |
830 | err = -EBUSY; | 830 | err = -EBUSY; |
831 | goto exit_journal; | 831 | goto exit_journal; |
@@ -988,13 +988,13 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
988 | " too large to resize to %lu blocks safely\n", | 988 | " too large to resize to %lu blocks safely\n", |
989 | sb->s_id, n_blocks_count); | 989 | sb->s_id, n_blocks_count); |
990 | if (sizeof(sector_t) < 8) | 990 | if (sizeof(sector_t) < 8) |
991 | ext3_warning(sb, __FUNCTION__, | 991 | ext3_warning(sb, __func__, |
992 | "CONFIG_LBD not enabled\n"); | 992 | "CONFIG_LBD not enabled\n"); |
993 | return -EINVAL; | 993 | return -EINVAL; |
994 | } | 994 | } |
995 | 995 | ||
996 | if (n_blocks_count < o_blocks_count) { | 996 | if (n_blocks_count < o_blocks_count) { |
997 | ext3_warning(sb, __FUNCTION__, | 997 | ext3_warning(sb, __func__, |
998 | "can't shrink FS - resize aborted"); | 998 | "can't shrink FS - resize aborted"); |
999 | return -EBUSY; | 999 | return -EBUSY; |
1000 | } | 1000 | } |
@@ -1004,7 +1004,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
1004 | EXT3_BLOCKS_PER_GROUP(sb); | 1004 | EXT3_BLOCKS_PER_GROUP(sb); |
1005 | 1005 | ||
1006 | if (last == 0) { | 1006 | if (last == 0) { |
1007 | ext3_warning(sb, __FUNCTION__, | 1007 | ext3_warning(sb, __func__, |
1008 | "need to use ext2online to resize further"); | 1008 | "need to use ext2online to resize further"); |
1009 | return -EPERM; | 1009 | return -EPERM; |
1010 | } | 1010 | } |
@@ -1012,7 +1012,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
1012 | add = EXT3_BLOCKS_PER_GROUP(sb) - last; | 1012 | add = EXT3_BLOCKS_PER_GROUP(sb) - last; |
1013 | 1013 | ||
1014 | if (o_blocks_count + add < o_blocks_count) { | 1014 | if (o_blocks_count + add < o_blocks_count) { |
1015 | ext3_warning(sb, __FUNCTION__, "blocks_count overflow"); | 1015 | ext3_warning(sb, __func__, "blocks_count overflow"); |
1016 | return -EINVAL; | 1016 | return -EINVAL; |
1017 | } | 1017 | } |
1018 | 1018 | ||
@@ -1020,7 +1020,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
1020 | add = n_blocks_count - o_blocks_count; | 1020 | add = n_blocks_count - o_blocks_count; |
1021 | 1021 | ||
1022 | if (o_blocks_count + add < n_blocks_count) | 1022 | if (o_blocks_count + add < n_blocks_count) |
1023 | ext3_warning(sb, __FUNCTION__, | 1023 | ext3_warning(sb, __func__, |
1024 | "will only finish group ("E3FSBLK | 1024 | "will only finish group ("E3FSBLK |
1025 | " blocks, %u new)", | 1025 | " blocks, %u new)", |
1026 | o_blocks_count + add, add); | 1026 | o_blocks_count + add, add); |
@@ -1028,7 +1028,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
1028 | /* See if the device is actually as big as what was requested */ | 1028 | /* See if the device is actually as big as what was requested */ |
1029 | bh = sb_bread(sb, o_blocks_count + add -1); | 1029 | bh = sb_bread(sb, o_blocks_count + add -1); |
1030 | if (!bh) { | 1030 | if (!bh) { |
1031 | ext3_warning(sb, __FUNCTION__, | 1031 | ext3_warning(sb, __func__, |
1032 | "can't read last block, resize aborted"); | 1032 | "can't read last block, resize aborted"); |
1033 | return -ENOSPC; | 1033 | return -ENOSPC; |
1034 | } | 1034 | } |
@@ -1040,22 +1040,23 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
1040 | handle = ext3_journal_start_sb(sb, 3); | 1040 | handle = ext3_journal_start_sb(sb, 3); |
1041 | if (IS_ERR(handle)) { | 1041 | if (IS_ERR(handle)) { |
1042 | err = PTR_ERR(handle); | 1042 | err = PTR_ERR(handle); |
1043 | ext3_warning(sb, __FUNCTION__, "error %d on journal start",err); | 1043 | ext3_warning(sb, __func__, "error %d on journal start",err); |
1044 | goto exit_put; | 1044 | goto exit_put; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | lock_super(sb); | 1047 | lock_super(sb); |
1048 | if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) { | 1048 | if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) { |
1049 | ext3_warning(sb, __FUNCTION__, | 1049 | ext3_warning(sb, __func__, |
1050 | "multiple resizers run on filesystem!"); | 1050 | "multiple resizers run on filesystem!"); |
1051 | unlock_super(sb); | 1051 | unlock_super(sb); |
1052 | ext3_journal_stop(handle); | ||
1052 | err = -EBUSY; | 1053 | err = -EBUSY; |
1053 | goto exit_put; | 1054 | goto exit_put; |
1054 | } | 1055 | } |
1055 | 1056 | ||
1056 | if ((err = ext3_journal_get_write_access(handle, | 1057 | if ((err = ext3_journal_get_write_access(handle, |
1057 | EXT3_SB(sb)->s_sbh))) { | 1058 | EXT3_SB(sb)->s_sbh))) { |
1058 | ext3_warning(sb, __FUNCTION__, | 1059 | ext3_warning(sb, __func__, |
1059 | "error %d on journal write access", err); | 1060 | "error %d on journal write access", err); |
1060 | unlock_super(sb); | 1061 | unlock_super(sb); |
1061 | ext3_journal_stop(handle); | 1062 | ext3_journal_stop(handle); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index ad5360664082..fe3119a71ada 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -84,7 +84,7 @@ handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) | |||
84 | * take the FS itself readonly cleanly. */ | 84 | * take the FS itself readonly cleanly. */ |
85 | journal = EXT3_SB(sb)->s_journal; | 85 | journal = EXT3_SB(sb)->s_journal; |
86 | if (is_journal_aborted(journal)) { | 86 | if (is_journal_aborted(journal)) { |
87 | ext3_abort(sb, __FUNCTION__, | 87 | ext3_abort(sb, __func__, |
88 | "Detected aborted journal"); | 88 | "Detected aborted journal"); |
89 | return ERR_PTR(-EROFS); | 89 | return ERR_PTR(-EROFS); |
90 | } | 90 | } |
@@ -304,7 +304,7 @@ void ext3_update_dynamic_rev(struct super_block *sb) | |||
304 | if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) | 304 | if (le32_to_cpu(es->s_rev_level) > EXT3_GOOD_OLD_REV) |
305 | return; | 305 | return; |
306 | 306 | ||
307 | ext3_warning(sb, __FUNCTION__, | 307 | ext3_warning(sb, __func__, |
308 | "updating to rev %d because of new feature flag, " | 308 | "updating to rev %d because of new feature flag, " |
309 | "running e2fsck is recommended", | 309 | "running e2fsck is recommended", |
310 | EXT3_DYNAMIC_REV); | 310 | EXT3_DYNAMIC_REV); |
@@ -685,7 +685,8 @@ static int ext3_acquire_dquot(struct dquot *dquot); | |||
685 | static int ext3_release_dquot(struct dquot *dquot); | 685 | static int ext3_release_dquot(struct dquot *dquot); |
686 | static int ext3_mark_dquot_dirty(struct dquot *dquot); | 686 | static int ext3_mark_dquot_dirty(struct dquot *dquot); |
687 | static int ext3_write_info(struct super_block *sb, int type); | 687 | static int ext3_write_info(struct super_block *sb, int type); |
688 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path); | 688 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, |
689 | char *path, int remount); | ||
689 | static int ext3_quota_on_mount(struct super_block *sb, int type); | 690 | static int ext3_quota_on_mount(struct super_block *sb, int type); |
690 | static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, | 691 | static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, |
691 | size_t len, loff_t off); | 692 | size_t len, loff_t off); |
@@ -1096,6 +1097,9 @@ clear_qf_name: | |||
1096 | case Opt_quota: | 1097 | case Opt_quota: |
1097 | case Opt_usrquota: | 1098 | case Opt_usrquota: |
1098 | case Opt_grpquota: | 1099 | case Opt_grpquota: |
1100 | printk(KERN_ERR | ||
1101 | "EXT3-fs: quota options not supported.\n"); | ||
1102 | break; | ||
1099 | case Opt_usrjquota: | 1103 | case Opt_usrjquota: |
1100 | case Opt_grpjquota: | 1104 | case Opt_grpjquota: |
1101 | case Opt_offusrjquota: | 1105 | case Opt_offusrjquota: |
@@ -1103,7 +1107,7 @@ clear_qf_name: | |||
1103 | case Opt_jqfmt_vfsold: | 1107 | case Opt_jqfmt_vfsold: |
1104 | case Opt_jqfmt_vfsv0: | 1108 | case Opt_jqfmt_vfsv0: |
1105 | printk(KERN_ERR | 1109 | printk(KERN_ERR |
1106 | "EXT3-fs: journalled quota options not " | 1110 | "EXT3-fs: journaled quota options not " |
1107 | "supported.\n"); | 1111 | "supported.\n"); |
1108 | break; | 1112 | break; |
1109 | case Opt_noquota: | 1113 | case Opt_noquota: |
@@ -1218,7 +1222,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1218 | inconsistencies, to force a fsck at reboot. But for | 1222 | inconsistencies, to force a fsck at reboot. But for |
1219 | a plain journaled filesystem we can keep it set as | 1223 | a plain journaled filesystem we can keep it set as |
1220 | valid forever! :) */ | 1224 | valid forever! :) */ |
1221 | es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS); | 1225 | es->s_state &= cpu_to_le16(~EXT3_VALID_FS); |
1222 | #endif | 1226 | #endif |
1223 | if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) | 1227 | if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) |
1224 | es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); | 1228 | es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); |
@@ -1253,14 +1257,14 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1253 | static int ext3_check_descriptors(struct super_block *sb) | 1257 | static int ext3_check_descriptors(struct super_block *sb) |
1254 | { | 1258 | { |
1255 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 1259 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
1256 | ext3_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
1257 | ext3_fsblk_t last_block; | ||
1258 | int i; | 1260 | int i; |
1259 | 1261 | ||
1260 | ext3_debug ("Checking group descriptors"); | 1262 | ext3_debug ("Checking group descriptors"); |
1261 | 1263 | ||
1262 | for (i = 0; i < sbi->s_groups_count; i++) { | 1264 | for (i = 0; i < sbi->s_groups_count; i++) { |
1263 | struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL); | 1265 | struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL); |
1266 | ext3_fsblk_t first_block = ext3_group_first_block_no(sb, i); | ||
1267 | ext3_fsblk_t last_block; | ||
1264 | 1268 | ||
1265 | if (i == sbi->s_groups_count - 1) | 1269 | if (i == sbi->s_groups_count - 1) |
1266 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 1270 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
@@ -1299,7 +1303,6 @@ static int ext3_check_descriptors(struct super_block *sb) | |||
1299 | le32_to_cpu(gdp->bg_inode_table)); | 1303 | le32_to_cpu(gdp->bg_inode_table)); |
1300 | return 0; | 1304 | return 0; |
1301 | } | 1305 | } |
1302 | first_block += EXT3_BLOCKS_PER_GROUP(sb); | ||
1303 | } | 1306 | } |
1304 | 1307 | ||
1305 | sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); | 1308 | sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb)); |
@@ -1387,7 +1390,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1387 | if (inode->i_nlink) { | 1390 | if (inode->i_nlink) { |
1388 | printk(KERN_DEBUG | 1391 | printk(KERN_DEBUG |
1389 | "%s: truncating inode %lu to %Ld bytes\n", | 1392 | "%s: truncating inode %lu to %Ld bytes\n", |
1390 | __FUNCTION__, inode->i_ino, inode->i_size); | 1393 | __func__, inode->i_ino, inode->i_size); |
1391 | jbd_debug(2, "truncating inode %lu to %Ld bytes\n", | 1394 | jbd_debug(2, "truncating inode %lu to %Ld bytes\n", |
1392 | inode->i_ino, inode->i_size); | 1395 | inode->i_ino, inode->i_size); |
1393 | ext3_truncate(inode); | 1396 | ext3_truncate(inode); |
@@ -1395,7 +1398,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1395 | } else { | 1398 | } else { |
1396 | printk(KERN_DEBUG | 1399 | printk(KERN_DEBUG |
1397 | "%s: deleting unreferenced inode %lu\n", | 1400 | "%s: deleting unreferenced inode %lu\n", |
1398 | __FUNCTION__, inode->i_ino); | 1401 | __func__, inode->i_ino); |
1399 | jbd_debug(2, "deleting unreferenced inode %lu\n", | 1402 | jbd_debug(2, "deleting unreferenced inode %lu\n", |
1400 | inode->i_ino); | 1403 | inode->i_ino); |
1401 | nr_orphans++; | 1404 | nr_orphans++; |
@@ -1415,7 +1418,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, | |||
1415 | /* Turn quotas off */ | 1418 | /* Turn quotas off */ |
1416 | for (i = 0; i < MAXQUOTAS; i++) { | 1419 | for (i = 0; i < MAXQUOTAS; i++) { |
1417 | if (sb_dqopt(sb)->files[i]) | 1420 | if (sb_dqopt(sb)->files[i]) |
1418 | vfs_quota_off(sb, i); | 1421 | vfs_quota_off(sb, i, 0); |
1419 | } | 1422 | } |
1420 | #endif | 1423 | #endif |
1421 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ | 1424 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ |
@@ -2298,9 +2301,9 @@ static void ext3_clear_journal_err(struct super_block * sb, | |||
2298 | char nbuf[16]; | 2301 | char nbuf[16]; |
2299 | 2302 | ||
2300 | errstr = ext3_decode_error(sb, j_errno, nbuf); | 2303 | errstr = ext3_decode_error(sb, j_errno, nbuf); |
2301 | ext3_warning(sb, __FUNCTION__, "Filesystem error recorded " | 2304 | ext3_warning(sb, __func__, "Filesystem error recorded " |
2302 | "from previous mount: %s", errstr); | 2305 | "from previous mount: %s", errstr); |
2303 | ext3_warning(sb, __FUNCTION__, "Marking fs in need of " | 2306 | ext3_warning(sb, __func__, "Marking fs in need of " |
2304 | "filesystem check."); | 2307 | "filesystem check."); |
2305 | 2308 | ||
2306 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; | 2309 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; |
@@ -2427,7 +2430,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2427 | } | 2430 | } |
2428 | 2431 | ||
2429 | if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) | 2432 | if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) |
2430 | ext3_abort(sb, __FUNCTION__, "Abort forced by user"); | 2433 | ext3_abort(sb, __func__, "Abort forced by user"); |
2431 | 2434 | ||
2432 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 2435 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
2433 | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 2436 | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); |
@@ -2639,8 +2642,14 @@ static int ext3_dquot_drop(struct inode *inode) | |||
2639 | 2642 | ||
2640 | /* We may delete quota structure so we need to reserve enough blocks */ | 2643 | /* We may delete quota structure so we need to reserve enough blocks */ |
2641 | handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb)); | 2644 | handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb)); |
2642 | if (IS_ERR(handle)) | 2645 | if (IS_ERR(handle)) { |
2646 | /* | ||
2647 | * We call dquot_drop() anyway to at least release references | ||
2648 | * to quota structures so that umount does not hang. | ||
2649 | */ | ||
2650 | dquot_drop(inode); | ||
2643 | return PTR_ERR(handle); | 2651 | return PTR_ERR(handle); |
2652 | } | ||
2644 | ret = dquot_drop(inode); | 2653 | ret = dquot_drop(inode); |
2645 | err = ext3_journal_stop(handle); | 2654 | err = ext3_journal_stop(handle); |
2646 | if (!ret) | 2655 | if (!ret) |
@@ -2743,17 +2752,17 @@ static int ext3_quota_on_mount(struct super_block *sb, int type) | |||
2743 | * Standard function to be called on quota_on | 2752 | * Standard function to be called on quota_on |
2744 | */ | 2753 | */ |
2745 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, | 2754 | static int ext3_quota_on(struct super_block *sb, int type, int format_id, |
2746 | char *path) | 2755 | char *path, int remount) |
2747 | { | 2756 | { |
2748 | int err; | 2757 | int err; |
2749 | struct nameidata nd; | 2758 | struct nameidata nd; |
2750 | 2759 | ||
2751 | if (!test_opt(sb, QUOTA)) | 2760 | if (!test_opt(sb, QUOTA)) |
2752 | return -EINVAL; | 2761 | return -EINVAL; |
2753 | /* Not journalling quota? */ | 2762 | /* Not journalling quota or remount? */ |
2754 | if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] && | 2763 | if ((!EXT3_SB(sb)->s_qf_names[USRQUOTA] && |
2755 | !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) | 2764 | !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) || remount) |
2756 | return vfs_quota_on(sb, type, format_id, path); | 2765 | return vfs_quota_on(sb, type, format_id, path, remount); |
2757 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); | 2766 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); |
2758 | if (err) | 2767 | if (err) |
2759 | return err; | 2768 | return err; |
@@ -2762,13 +2771,13 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, | |||
2762 | path_put(&nd.path); | 2771 | path_put(&nd.path); |
2763 | return -EXDEV; | 2772 | return -EXDEV; |
2764 | } | 2773 | } |
2765 | /* Quotafile not of fs root? */ | 2774 | /* Quotafile not in fs root? */ |
2766 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) | 2775 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) |
2767 | printk(KERN_WARNING | 2776 | printk(KERN_WARNING |
2768 | "EXT3-fs: Quota file not on filesystem root. " | 2777 | "EXT3-fs: Quota file not on filesystem root. " |
2769 | "Journalled quota will not work.\n"); | 2778 | "Journalled quota will not work.\n"); |
2770 | path_put(&nd.path); | 2779 | path_put(&nd.path); |
2771 | return vfs_quota_on(sb, type, format_id, path); | 2780 | return vfs_quota_on(sb, type, format_id, path, remount); |
2772 | } | 2781 | } |
2773 | 2782 | ||
2774 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | 2783 | /* Read data from quotafile - avoid pagecache and such because we cannot afford |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 42856541e9a5..d4a4f0e9ff69 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -99,6 +99,8 @@ static struct buffer_head *ext3_xattr_cache_find(struct inode *, | |||
99 | struct mb_cache_entry **); | 99 | struct mb_cache_entry **); |
100 | static void ext3_xattr_rehash(struct ext3_xattr_header *, | 100 | static void ext3_xattr_rehash(struct ext3_xattr_header *, |
101 | struct ext3_xattr_entry *); | 101 | struct ext3_xattr_entry *); |
102 | static int ext3_xattr_list(struct inode *inode, char *buffer, | ||
103 | size_t buffer_size); | ||
102 | 104 | ||
103 | static struct mb_cache *ext3_xattr_cache; | 105 | static struct mb_cache *ext3_xattr_cache; |
104 | 106 | ||
@@ -232,7 +234,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name, | |||
232 | ea_bdebug(bh, "b_count=%d, refcount=%d", | 234 | ea_bdebug(bh, "b_count=%d, refcount=%d", |
233 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); | 235 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); |
234 | if (ext3_xattr_check_block(bh)) { | 236 | if (ext3_xattr_check_block(bh)) { |
235 | bad_block: ext3_error(inode->i_sb, __FUNCTION__, | 237 | bad_block: ext3_error(inode->i_sb, __func__, |
236 | "inode %lu: bad block "E3FSBLK, inode->i_ino, | 238 | "inode %lu: bad block "E3FSBLK, inode->i_ino, |
237 | EXT3_I(inode)->i_file_acl); | 239 | EXT3_I(inode)->i_file_acl); |
238 | error = -EIO; | 240 | error = -EIO; |
@@ -374,7 +376,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) | |||
374 | ea_bdebug(bh, "b_count=%d, refcount=%d", | 376 | ea_bdebug(bh, "b_count=%d, refcount=%d", |
375 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); | 377 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); |
376 | if (ext3_xattr_check_block(bh)) { | 378 | if (ext3_xattr_check_block(bh)) { |
377 | ext3_error(inode->i_sb, __FUNCTION__, | 379 | ext3_error(inode->i_sb, __func__, |
378 | "inode %lu: bad block "E3FSBLK, inode->i_ino, | 380 | "inode %lu: bad block "E3FSBLK, inode->i_ino, |
379 | EXT3_I(inode)->i_file_acl); | 381 | EXT3_I(inode)->i_file_acl); |
380 | error = -EIO; | 382 | error = -EIO; |
@@ -427,7 +429,7 @@ cleanup: | |||
427 | * Returns a negative error number on failure, or the number of bytes | 429 | * Returns a negative error number on failure, or the number of bytes |
428 | * used / required on success. | 430 | * used / required on success. |
429 | */ | 431 | */ |
430 | int | 432 | static int |
431 | ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) | 433 | ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) |
432 | { | 434 | { |
433 | int i_error, b_error; | 435 | int i_error, b_error; |
@@ -649,7 +651,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i, | |||
649 | atomic_read(&(bs->bh->b_count)), | 651 | atomic_read(&(bs->bh->b_count)), |
650 | le32_to_cpu(BHDR(bs->bh)->h_refcount)); | 652 | le32_to_cpu(BHDR(bs->bh)->h_refcount)); |
651 | if (ext3_xattr_check_block(bs->bh)) { | 653 | if (ext3_xattr_check_block(bs->bh)) { |
652 | ext3_error(sb, __FUNCTION__, | 654 | ext3_error(sb, __func__, |
653 | "inode %lu: bad block "E3FSBLK, inode->i_ino, | 655 | "inode %lu: bad block "E3FSBLK, inode->i_ino, |
654 | EXT3_I(inode)->i_file_acl); | 656 | EXT3_I(inode)->i_file_acl); |
655 | error = -EIO; | 657 | error = -EIO; |
@@ -797,10 +799,8 @@ inserted: | |||
797 | get_bh(new_bh); | 799 | get_bh(new_bh); |
798 | } else { | 800 | } else { |
799 | /* We need to allocate a new block */ | 801 | /* We need to allocate a new block */ |
800 | ext3_fsblk_t goal = le32_to_cpu( | 802 | ext3_fsblk_t goal = ext3_group_first_block_no(sb, |
801 | EXT3_SB(sb)->s_es->s_first_data_block) + | 803 | EXT3_I(inode)->i_block_group); |
802 | (ext3_fsblk_t)EXT3_I(inode)->i_block_group * | ||
803 | EXT3_BLOCKS_PER_GROUP(sb); | ||
804 | ext3_fsblk_t block = ext3_new_block(handle, inode, | 804 | ext3_fsblk_t block = ext3_new_block(handle, inode, |
805 | goal, &error); | 805 | goal, &error); |
806 | if (error) | 806 | if (error) |
@@ -852,7 +852,7 @@ cleanup_dquot: | |||
852 | goto cleanup; | 852 | goto cleanup; |
853 | 853 | ||
854 | bad_block: | 854 | bad_block: |
855 | ext3_error(inode->i_sb, __FUNCTION__, | 855 | ext3_error(inode->i_sb, __func__, |
856 | "inode %lu: bad block "E3FSBLK, inode->i_ino, | 856 | "inode %lu: bad block "E3FSBLK, inode->i_ino, |
857 | EXT3_I(inode)->i_file_acl); | 857 | EXT3_I(inode)->i_file_acl); |
858 | goto cleanup; | 858 | goto cleanup; |
@@ -1081,14 +1081,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode) | |||
1081 | goto cleanup; | 1081 | goto cleanup; |
1082 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); | 1082 | bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); |
1083 | if (!bh) { | 1083 | if (!bh) { |
1084 | ext3_error(inode->i_sb, __FUNCTION__, | 1084 | ext3_error(inode->i_sb, __func__, |
1085 | "inode %lu: block "E3FSBLK" read error", inode->i_ino, | 1085 | "inode %lu: block "E3FSBLK" read error", inode->i_ino, |
1086 | EXT3_I(inode)->i_file_acl); | 1086 | EXT3_I(inode)->i_file_acl); |
1087 | goto cleanup; | 1087 | goto cleanup; |
1088 | } | 1088 | } |
1089 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || | 1089 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || |
1090 | BHDR(bh)->h_blocks != cpu_to_le32(1)) { | 1090 | BHDR(bh)->h_blocks != cpu_to_le32(1)) { |
1091 | ext3_error(inode->i_sb, __FUNCTION__, | 1091 | ext3_error(inode->i_sb, __func__, |
1092 | "inode %lu: bad block "E3FSBLK, inode->i_ino, | 1092 | "inode %lu: bad block "E3FSBLK, inode->i_ino, |
1093 | EXT3_I(inode)->i_file_acl); | 1093 | EXT3_I(inode)->i_file_acl); |
1094 | goto cleanup; | 1094 | goto cleanup; |
@@ -1215,7 +1215,7 @@ again: | |||
1215 | } | 1215 | } |
1216 | bh = sb_bread(inode->i_sb, ce->e_block); | 1216 | bh = sb_bread(inode->i_sb, ce->e_block); |
1217 | if (!bh) { | 1217 | if (!bh) { |
1218 | ext3_error(inode->i_sb, __FUNCTION__, | 1218 | ext3_error(inode->i_sb, __func__, |
1219 | "inode %lu: block %lu read error", | 1219 | "inode %lu: block %lu read error", |
1220 | inode->i_ino, (unsigned long) ce->e_block); | 1220 | inode->i_ino, (unsigned long) ce->e_block); |
1221 | } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= | 1221 | } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= |
diff --git a/fs/ext3/xattr.h b/fs/ext3/xattr.h index 6b1ae1c6182c..148a4dfc82ab 100644 --- a/fs/ext3/xattr.h +++ b/fs/ext3/xattr.h | |||
@@ -67,7 +67,6 @@ extern struct xattr_handler ext3_xattr_security_handler; | |||
67 | extern ssize_t ext3_listxattr(struct dentry *, char *, size_t); | 67 | extern ssize_t ext3_listxattr(struct dentry *, char *, size_t); |
68 | 68 | ||
69 | extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t); | 69 | extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t); |
70 | extern int ext3_xattr_list(struct inode *, char *, size_t); | ||
71 | extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int); | 70 | extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int); |
72 | extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int); | 71 | extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int); |
73 | 72 | ||
@@ -89,12 +88,6 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name, | |||
89 | } | 88 | } |
90 | 89 | ||
91 | static inline int | 90 | static inline int |
92 | ext3_xattr_list(struct inode *inode, void *buffer, size_t size) | ||
93 | { | ||
94 | return -EOPNOTSUPP; | ||
95 | } | ||
96 | |||
97 | static inline int | ||
98 | ext3_xattr_set(struct inode *inode, int name_index, const char *name, | 91 | ext3_xattr_set(struct inode *inode, int name_index, const char *name, |
99 | const void *value, size_t size, int flags) | 92 | const void *value, size_t size, int flags) |
100 | { | 93 | { |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 13383ba18f1d..c81a8e759bad 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -813,7 +813,8 @@ static int ext4_acquire_dquot(struct dquot *dquot); | |||
813 | static int ext4_release_dquot(struct dquot *dquot); | 813 | static int ext4_release_dquot(struct dquot *dquot); |
814 | static int ext4_mark_dquot_dirty(struct dquot *dquot); | 814 | static int ext4_mark_dquot_dirty(struct dquot *dquot); |
815 | static int ext4_write_info(struct super_block *sb, int type); | 815 | static int ext4_write_info(struct super_block *sb, int type); |
816 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, char *path); | 816 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
817 | char *path, int remount); | ||
817 | static int ext4_quota_on_mount(struct super_block *sb, int type); | 818 | static int ext4_quota_on_mount(struct super_block *sb, int type); |
818 | static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, | 819 | static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, |
819 | size_t len, loff_t off); | 820 | size_t len, loff_t off); |
@@ -1632,7 +1633,7 @@ static void ext4_orphan_cleanup (struct super_block * sb, | |||
1632 | /* Turn quotas off */ | 1633 | /* Turn quotas off */ |
1633 | for (i = 0; i < MAXQUOTAS; i++) { | 1634 | for (i = 0; i < MAXQUOTAS; i++) { |
1634 | if (sb_dqopt(sb)->files[i]) | 1635 | if (sb_dqopt(sb)->files[i]) |
1635 | vfs_quota_off(sb, i); | 1636 | vfs_quota_off(sb, i, 0); |
1636 | } | 1637 | } |
1637 | #endif | 1638 | #endif |
1638 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ | 1639 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ |
@@ -3143,7 +3144,7 @@ static int ext4_quota_on_mount(struct super_block *sb, int type) | |||
3143 | * Standard function to be called on quota_on | 3144 | * Standard function to be called on quota_on |
3144 | */ | 3145 | */ |
3145 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, | 3146 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
3146 | char *path) | 3147 | char *path, int remount) |
3147 | { | 3148 | { |
3148 | int err; | 3149 | int err; |
3149 | struct nameidata nd; | 3150 | struct nameidata nd; |
@@ -3151,9 +3152,9 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
3151 | if (!test_opt(sb, QUOTA)) | 3152 | if (!test_opt(sb, QUOTA)) |
3152 | return -EINVAL; | 3153 | return -EINVAL; |
3153 | /* Not journalling quota? */ | 3154 | /* Not journalling quota? */ |
3154 | if (!EXT4_SB(sb)->s_qf_names[USRQUOTA] && | 3155 | if ((!EXT4_SB(sb)->s_qf_names[USRQUOTA] && |
3155 | !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) | 3156 | !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) || remount) |
3156 | return vfs_quota_on(sb, type, format_id, path); | 3157 | return vfs_quota_on(sb, type, format_id, path, remount); |
3157 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); | 3158 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); |
3158 | if (err) | 3159 | if (err) |
3159 | return err; | 3160 | return err; |
@@ -3168,7 +3169,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
3168 | "EXT4-fs: Quota file not on filesystem root. " | 3169 | "EXT4-fs: Quota file not on filesystem root. " |
3169 | "Journalled quota will not work.\n"); | 3170 | "Journalled quota will not work.\n"); |
3170 | path_put(&nd.path); | 3171 | path_put(&nd.path); |
3171 | return vfs_quota_on(sb, type, format_id, path); | 3172 | return vfs_quota_on(sb, type, format_id, path, remount); |
3172 | } | 3173 | } |
3173 | 3174 | ||
3174 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | 3175 | /* Read data from quotafile - avoid pagecache and such because we cannot afford |
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 72cbcd61bd95..486725ee99ae 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -124,8 +124,8 @@ static inline int fat_get_entry(struct inode *dir, loff_t *pos, | |||
124 | * but ignore that right now. | 124 | * but ignore that right now. |
125 | * Ahem... Stack smashing in ring 0 isn't fun. Fixed. | 125 | * Ahem... Stack smashing in ring 0 isn't fun. Fixed. |
126 | */ | 126 | */ |
127 | static int uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate, | 127 | static int uni16_to_x8(unsigned char *ascii, wchar_t *uni, int len, |
128 | struct nls_table *nls) | 128 | int uni_xlate, struct nls_table *nls) |
129 | { | 129 | { |
130 | wchar_t *ip, ec; | 130 | wchar_t *ip, ec; |
131 | unsigned char *op, nc; | 131 | unsigned char *op, nc; |
@@ -135,10 +135,11 @@ static int uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate, | |||
135 | ip = uni; | 135 | ip = uni; |
136 | op = ascii; | 136 | op = ascii; |
137 | 137 | ||
138 | while (*ip) { | 138 | while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) { |
139 | ec = *ip++; | 139 | ec = *ip++; |
140 | if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) { | 140 | if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) { |
141 | op += charlen; | 141 | op += charlen; |
142 | len -= charlen; | ||
142 | } else { | 143 | } else { |
143 | if (uni_xlate == 1) { | 144 | if (uni_xlate == 1) { |
144 | *op = ':'; | 145 | *op = ':'; |
@@ -149,16 +150,19 @@ static int uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate, | |||
149 | ec >>= 4; | 150 | ec >>= 4; |
150 | } | 151 | } |
151 | op += 5; | 152 | op += 5; |
153 | len -= 5; | ||
152 | } else { | 154 | } else { |
153 | *op++ = '?'; | 155 | *op++ = '?'; |
156 | len--; | ||
154 | } | 157 | } |
155 | } | 158 | } |
156 | /* We have some slack there, so it's OK */ | ||
157 | if (op>ascii+256) { | ||
158 | op = ascii + 256; | ||
159 | break; | ||
160 | } | ||
161 | } | 159 | } |
160 | |||
161 | if (unlikely(*ip)) { | ||
162 | printk(KERN_WARNING "FAT: filename was truncated while " | ||
163 | "converting."); | ||
164 | } | ||
165 | |||
162 | *op = 0; | 166 | *op = 0; |
163 | return (op - ascii); | 167 | return (op - ascii); |
164 | } | 168 | } |
@@ -243,7 +247,7 @@ static int fat_parse_long(struct inode *dir, loff_t *pos, | |||
243 | unsigned char id, slot, slots, alias_checksum; | 247 | unsigned char id, slot, slots, alias_checksum; |
244 | 248 | ||
245 | if (!*unicode) { | 249 | if (!*unicode) { |
246 | *unicode = (wchar_t *)__get_free_page(GFP_KERNEL); | 250 | *unicode = __getname(); |
247 | if (!*unicode) { | 251 | if (!*unicode) { |
248 | brelse(*bh); | 252 | brelse(*bh); |
249 | return -ENOMEM; | 253 | return -ENOMEM; |
@@ -311,9 +315,11 @@ int fat_search_long(struct inode *inode, const unsigned char *name, | |||
311 | struct nls_table *nls_io = sbi->nls_io; | 315 | struct nls_table *nls_io = sbi->nls_io; |
312 | struct nls_table *nls_disk = sbi->nls_disk; | 316 | struct nls_table *nls_disk = sbi->nls_disk; |
313 | wchar_t bufuname[14]; | 317 | wchar_t bufuname[14]; |
314 | unsigned char xlate_len, nr_slots; | 318 | unsigned char nr_slots; |
319 | int xlate_len; | ||
315 | wchar_t *unicode = NULL; | 320 | wchar_t *unicode = NULL; |
316 | unsigned char work[MSDOS_NAME], bufname[260]; /* 256 + 4 */ | 321 | unsigned char work[MSDOS_NAME]; |
322 | unsigned char *bufname = NULL; | ||
317 | int uni_xlate = sbi->options.unicode_xlate; | 323 | int uni_xlate = sbi->options.unicode_xlate; |
318 | int utf8 = sbi->options.utf8; | 324 | int utf8 = sbi->options.utf8; |
319 | int anycase = (sbi->options.name_check != 's'); | 325 | int anycase = (sbi->options.name_check != 's'); |
@@ -321,6 +327,10 @@ int fat_search_long(struct inode *inode, const unsigned char *name, | |||
321 | loff_t cpos = 0; | 327 | loff_t cpos = 0; |
322 | int chl, i, j, last_u, err; | 328 | int chl, i, j, last_u, err; |
323 | 329 | ||
330 | bufname = __getname(); | ||
331 | if (!bufname) | ||
332 | return -ENOMEM; | ||
333 | |||
324 | err = -ENOENT; | 334 | err = -ENOENT; |
325 | while(1) { | 335 | while(1) { |
326 | if (fat_get_entry(inode, &cpos, &bh, &de) == -1) | 336 | if (fat_get_entry(inode, &cpos, &bh, &de) == -1) |
@@ -386,8 +396,8 @@ parse_record: | |||
386 | 396 | ||
387 | bufuname[last_u] = 0x0000; | 397 | bufuname[last_u] = 0x0000; |
388 | xlate_len = utf8 | 398 | xlate_len = utf8 |
389 | ?utf8_wcstombs(bufname, bufuname, sizeof(bufname)) | 399 | ?utf8_wcstombs(bufname, bufuname, PATH_MAX) |
390 | :uni16_to_x8(bufname, bufuname, uni_xlate, nls_io); | 400 | :uni16_to_x8(bufname, bufuname, PATH_MAX, uni_xlate, nls_io); |
391 | if (xlate_len == name_len) | 401 | if (xlate_len == name_len) |
392 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || | 402 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || |
393 | (anycase && !nls_strnicmp(nls_io, name, bufname, | 403 | (anycase && !nls_strnicmp(nls_io, name, bufname, |
@@ -396,8 +406,8 @@ parse_record: | |||
396 | 406 | ||
397 | if (nr_slots) { | 407 | if (nr_slots) { |
398 | xlate_len = utf8 | 408 | xlate_len = utf8 |
399 | ?utf8_wcstombs(bufname, unicode, sizeof(bufname)) | 409 | ?utf8_wcstombs(bufname, unicode, PATH_MAX) |
400 | :uni16_to_x8(bufname, unicode, uni_xlate, nls_io); | 410 | :uni16_to_x8(bufname, unicode, PATH_MAX, uni_xlate, nls_io); |
401 | if (xlate_len != name_len) | 411 | if (xlate_len != name_len) |
402 | continue; | 412 | continue; |
403 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || | 413 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || |
@@ -416,8 +426,10 @@ Found: | |||
416 | sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); | 426 | sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); |
417 | err = 0; | 427 | err = 0; |
418 | EODir: | 428 | EODir: |
429 | if (bufname) | ||
430 | __putname(bufname); | ||
419 | if (unicode) | 431 | if (unicode) |
420 | free_page((unsigned long)unicode); | 432 | __putname(unicode); |
421 | 433 | ||
422 | return err; | 434 | return err; |
423 | } | 435 | } |
@@ -598,7 +610,7 @@ parse_record: | |||
598 | if (isvfat) { | 610 | if (isvfat) { |
599 | bufuname[j] = 0x0000; | 611 | bufuname[j] = 0x0000; |
600 | i = utf8 ? utf8_wcstombs(bufname, bufuname, sizeof(bufname)) | 612 | i = utf8 ? utf8_wcstombs(bufname, bufuname, sizeof(bufname)) |
601 | : uni16_to_x8(bufname, bufuname, uni_xlate, nls_io); | 613 | : uni16_to_x8(bufname, bufuname, sizeof(bufname), uni_xlate, nls_io); |
602 | } | 614 | } |
603 | 615 | ||
604 | fill_name = bufname; | 616 | fill_name = bufname; |
@@ -607,10 +619,10 @@ parse_record: | |||
607 | /* convert the unicode long name. 261 is maximum size | 619 | /* convert the unicode long name. 261 is maximum size |
608 | * of unicode buffer. (13 * slots + nul) */ | 620 | * of unicode buffer. (13 * slots + nul) */ |
609 | void *longname = unicode + 261; | 621 | void *longname = unicode + 261; |
610 | int buf_size = PAGE_SIZE - (261 * sizeof(unicode[0])); | 622 | int buf_size = PATH_MAX - (261 * sizeof(unicode[0])); |
611 | int long_len = utf8 | 623 | int long_len = utf8 |
612 | ? utf8_wcstombs(longname, unicode, buf_size) | 624 | ? utf8_wcstombs(longname, unicode, buf_size) |
613 | : uni16_to_x8(longname, unicode, uni_xlate, nls_io); | 625 | : uni16_to_x8(longname, unicode, buf_size, uni_xlate, nls_io); |
614 | 626 | ||
615 | if (!both) { | 627 | if (!both) { |
616 | fill_name = longname; | 628 | fill_name = longname; |
@@ -640,7 +652,7 @@ EODir: | |||
640 | FillFailed: | 652 | FillFailed: |
641 | brelse(bh); | 653 | brelse(bh); |
642 | if (unicode) | 654 | if (unicode) |
643 | free_page((unsigned long)unicode); | 655 | __putname(unicode); |
644 | out: | 656 | out: |
645 | unlock_kernel(); | 657 | unlock_kernel(); |
646 | return ret; | 658 | return ret; |
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c index 5fb366992b73..13ab763cc510 100644 --- a/fs/fat/fatent.c +++ b/fs/fat/fatent.c | |||
@@ -450,7 +450,8 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster) | |||
450 | BUG_ON(nr_cluster > (MAX_BUF_PER_PAGE / 2)); /* fixed limit */ | 450 | BUG_ON(nr_cluster > (MAX_BUF_PER_PAGE / 2)); /* fixed limit */ |
451 | 451 | ||
452 | lock_fat(sbi); | 452 | lock_fat(sbi); |
453 | if (sbi->free_clusters != -1 && sbi->free_clusters < nr_cluster) { | 453 | if (sbi->free_clusters != -1 && sbi->free_clus_valid && |
454 | sbi->free_clusters < nr_cluster) { | ||
454 | unlock_fat(sbi); | 455 | unlock_fat(sbi); |
455 | return -ENOSPC; | 456 | return -ENOSPC; |
456 | } | 457 | } |
@@ -504,6 +505,7 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster) | |||
504 | 505 | ||
505 | /* Couldn't allocate the free entries */ | 506 | /* Couldn't allocate the free entries */ |
506 | sbi->free_clusters = 0; | 507 | sbi->free_clusters = 0; |
508 | sbi->free_clus_valid = 1; | ||
507 | sb->s_dirt = 1; | 509 | sb->s_dirt = 1; |
508 | err = -ENOSPC; | 510 | err = -ENOSPC; |
509 | 511 | ||
@@ -583,8 +585,6 @@ error: | |||
583 | brelse(bhs[i]); | 585 | brelse(bhs[i]); |
584 | unlock_fat(sbi); | 586 | unlock_fat(sbi); |
585 | 587 | ||
586 | fat_clusters_flush(sb); | ||
587 | |||
588 | return err; | 588 | return err; |
589 | } | 589 | } |
590 | 590 | ||
@@ -615,7 +615,7 @@ int fat_count_free_clusters(struct super_block *sb) | |||
615 | int err = 0, free; | 615 | int err = 0, free; |
616 | 616 | ||
617 | lock_fat(sbi); | 617 | lock_fat(sbi); |
618 | if (sbi->free_clusters != -1) | 618 | if (sbi->free_clusters != -1 && sbi->free_clus_valid) |
619 | goto out; | 619 | goto out; |
620 | 620 | ||
621 | reada_blocks = FAT_READA_SIZE >> sb->s_blocksize_bits; | 621 | reada_blocks = FAT_READA_SIZE >> sb->s_blocksize_bits; |
@@ -643,6 +643,7 @@ int fat_count_free_clusters(struct super_block *sb) | |||
643 | } while (fat_ent_next(sbi, &fatent)); | 643 | } while (fat_ent_next(sbi, &fatent)); |
644 | } | 644 | } |
645 | sbi->free_clusters = free; | 645 | sbi->free_clusters = free; |
646 | sbi->free_clus_valid = 1; | ||
646 | sb->s_dirt = 1; | 647 | sb->s_dirt = 1; |
647 | fatent_brelse(&fatent); | 648 | fatent_brelse(&fatent); |
648 | out: | 649 | out: |
diff --git a/fs/fat/file.c b/fs/fat/file.c index 2a3bed967041..d604bb132422 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -157,104 +157,6 @@ out: | |||
157 | return err; | 157 | return err; |
158 | } | 158 | } |
159 | 159 | ||
160 | static int check_mode(const struct msdos_sb_info *sbi, mode_t mode) | ||
161 | { | ||
162 | mode_t req = mode & ~S_IFMT; | ||
163 | |||
164 | /* | ||
165 | * Of the r and x bits, all (subject to umask) must be present. Of the | ||
166 | * w bits, either all (subject to umask) or none must be present. | ||
167 | */ | ||
168 | |||
169 | if (S_ISREG(mode)) { | ||
170 | req &= ~sbi->options.fs_fmask; | ||
171 | |||
172 | if ((req & (S_IRUGO | S_IXUGO)) != | ||
173 | ((S_IRUGO | S_IXUGO) & ~sbi->options.fs_fmask)) | ||
174 | return -EPERM; | ||
175 | |||
176 | if ((req & S_IWUGO) != 0 && | ||
177 | (req & S_IWUGO) != (S_IWUGO & ~sbi->options.fs_fmask)) | ||
178 | return -EPERM; | ||
179 | } else if (S_ISDIR(mode)) { | ||
180 | req &= ~sbi->options.fs_dmask; | ||
181 | |||
182 | if ((req & (S_IRUGO | S_IXUGO)) != | ||
183 | ((S_IRUGO | S_IXUGO) & ~sbi->options.fs_dmask)) | ||
184 | return -EPERM; | ||
185 | |||
186 | if ((req & S_IWUGO) != 0 && | ||
187 | (req & S_IWUGO) != (S_IWUGO & ~sbi->options.fs_dmask)) | ||
188 | return -EPERM; | ||
189 | } else { | ||
190 | return -EPERM; | ||
191 | } | ||
192 | |||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | int fat_notify_change(struct dentry *dentry, struct iattr *attr) | ||
197 | { | ||
198 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); | ||
199 | struct inode *inode = dentry->d_inode; | ||
200 | int mask, error = 0; | ||
201 | |||
202 | lock_kernel(); | ||
203 | |||
204 | /* | ||
205 | * Expand the file. Since inode_setattr() updates ->i_size | ||
206 | * before calling the ->truncate(), but FAT needs to fill the | ||
207 | * hole before it. | ||
208 | */ | ||
209 | if (attr->ia_valid & ATTR_SIZE) { | ||
210 | if (attr->ia_size > inode->i_size) { | ||
211 | error = fat_cont_expand(inode, attr->ia_size); | ||
212 | if (error || attr->ia_valid == ATTR_SIZE) | ||
213 | goto out; | ||
214 | attr->ia_valid &= ~ATTR_SIZE; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | error = inode_change_ok(inode, attr); | ||
219 | if (error) { | ||
220 | if (sbi->options.quiet) | ||
221 | error = 0; | ||
222 | goto out; | ||
223 | } | ||
224 | if (((attr->ia_valid & ATTR_UID) && | ||
225 | (attr->ia_uid != sbi->options.fs_uid)) || | ||
226 | ((attr->ia_valid & ATTR_GID) && | ||
227 | (attr->ia_gid != sbi->options.fs_gid))) | ||
228 | error = -EPERM; | ||
229 | |||
230 | if (error) { | ||
231 | if (sbi->options.quiet) | ||
232 | error = 0; | ||
233 | goto out; | ||
234 | } | ||
235 | |||
236 | if (attr->ia_valid & ATTR_MODE) { | ||
237 | error = check_mode(sbi, attr->ia_mode); | ||
238 | if (error != 0 && !sbi->options.quiet) | ||
239 | goto out; | ||
240 | } | ||
241 | |||
242 | error = inode_setattr(inode, attr); | ||
243 | if (error) | ||
244 | goto out; | ||
245 | |||
246 | if (S_ISDIR(inode->i_mode)) | ||
247 | mask = sbi->options.fs_dmask; | ||
248 | else | ||
249 | mask = sbi->options.fs_fmask; | ||
250 | inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask); | ||
251 | out: | ||
252 | unlock_kernel(); | ||
253 | return error; | ||
254 | } | ||
255 | |||
256 | EXPORT_SYMBOL_GPL(fat_notify_change); | ||
257 | |||
258 | /* Free all clusters after the skip'th cluster. */ | 160 | /* Free all clusters after the skip'th cluster. */ |
259 | static int fat_free(struct inode *inode, int skip) | 161 | static int fat_free(struct inode *inode, int skip) |
260 | { | 162 | { |
@@ -355,8 +257,112 @@ int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
355 | } | 257 | } |
356 | EXPORT_SYMBOL_GPL(fat_getattr); | 258 | EXPORT_SYMBOL_GPL(fat_getattr); |
357 | 259 | ||
260 | static int fat_check_mode(const struct msdos_sb_info *sbi, struct inode *inode, | ||
261 | mode_t mode) | ||
262 | { | ||
263 | mode_t mask, req = mode & ~S_IFMT; | ||
264 | |||
265 | if (S_ISREG(mode)) | ||
266 | mask = sbi->options.fs_fmask; | ||
267 | else | ||
268 | mask = sbi->options.fs_dmask; | ||
269 | |||
270 | /* | ||
271 | * Of the r and x bits, all (subject to umask) must be present. Of the | ||
272 | * w bits, either all (subject to umask) or none must be present. | ||
273 | */ | ||
274 | req &= ~mask; | ||
275 | if ((req & (S_IRUGO | S_IXUGO)) != (inode->i_mode & (S_IRUGO|S_IXUGO))) | ||
276 | return -EPERM; | ||
277 | if ((req & S_IWUGO) && ((req & S_IWUGO) != (S_IWUGO & ~mask))) | ||
278 | return -EPERM; | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) | ||
284 | { | ||
285 | mode_t allow_utime = sbi->options.allow_utime; | ||
286 | |||
287 | if (current->fsuid != inode->i_uid) { | ||
288 | if (in_group_p(inode->i_gid)) | ||
289 | allow_utime >>= 3; | ||
290 | if (allow_utime & MAY_WRITE) | ||
291 | return 1; | ||
292 | } | ||
293 | |||
294 | /* use a default check */ | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | int fat_setattr(struct dentry *dentry, struct iattr *attr) | ||
299 | { | ||
300 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); | ||
301 | struct inode *inode = dentry->d_inode; | ||
302 | int mask, error = 0; | ||
303 | unsigned int ia_valid; | ||
304 | |||
305 | lock_kernel(); | ||
306 | |||
307 | /* | ||
308 | * Expand the file. Since inode_setattr() updates ->i_size | ||
309 | * before calling the ->truncate(), but FAT needs to fill the | ||
310 | * hole before it. | ||
311 | */ | ||
312 | if (attr->ia_valid & ATTR_SIZE) { | ||
313 | if (attr->ia_size > inode->i_size) { | ||
314 | error = fat_cont_expand(inode, attr->ia_size); | ||
315 | if (error || attr->ia_valid == ATTR_SIZE) | ||
316 | goto out; | ||
317 | attr->ia_valid &= ~ATTR_SIZE; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | /* Check for setting the inode time. */ | ||
322 | ia_valid = attr->ia_valid; | ||
323 | if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) { | ||
324 | if (fat_allow_set_time(sbi, inode)) | ||
325 | attr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET); | ||
326 | } | ||
327 | |||
328 | error = inode_change_ok(inode, attr); | ||
329 | attr->ia_valid = ia_valid; | ||
330 | if (error) { | ||
331 | if (sbi->options.quiet) | ||
332 | error = 0; | ||
333 | goto out; | ||
334 | } | ||
335 | if (((attr->ia_valid & ATTR_UID) && | ||
336 | (attr->ia_uid != sbi->options.fs_uid)) || | ||
337 | ((attr->ia_valid & ATTR_GID) && | ||
338 | (attr->ia_gid != sbi->options.fs_gid)) || | ||
339 | ((attr->ia_valid & ATTR_MODE) && | ||
340 | fat_check_mode(sbi, inode, attr->ia_mode) < 0)) | ||
341 | error = -EPERM; | ||
342 | |||
343 | if (error) { | ||
344 | if (sbi->options.quiet) | ||
345 | error = 0; | ||
346 | goto out; | ||
347 | } | ||
348 | |||
349 | error = inode_setattr(inode, attr); | ||
350 | if (error) | ||
351 | goto out; | ||
352 | |||
353 | if (S_ISDIR(inode->i_mode)) | ||
354 | mask = sbi->options.fs_dmask; | ||
355 | else | ||
356 | mask = sbi->options.fs_fmask; | ||
357 | inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask); | ||
358 | out: | ||
359 | unlock_kernel(); | ||
360 | return error; | ||
361 | } | ||
362 | EXPORT_SYMBOL_GPL(fat_setattr); | ||
363 | |||
358 | const struct inode_operations fat_file_inode_operations = { | 364 | const struct inode_operations fat_file_inode_operations = { |
359 | .truncate = fat_truncate, | 365 | .truncate = fat_truncate, |
360 | .setattr = fat_notify_change, | 366 | .setattr = fat_setattr, |
361 | .getattr = fat_getattr, | 367 | .getattr = fat_getattr, |
362 | }; | 368 | }; |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 53f3cf62b7c1..5f522a55b596 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -433,11 +433,8 @@ EXPORT_SYMBOL_GPL(fat_build_inode); | |||
433 | static void fat_delete_inode(struct inode *inode) | 433 | static void fat_delete_inode(struct inode *inode) |
434 | { | 434 | { |
435 | truncate_inode_pages(&inode->i_data, 0); | 435 | truncate_inode_pages(&inode->i_data, 0); |
436 | 436 | inode->i_size = 0; | |
437 | if (!is_bad_inode(inode)) { | 437 | fat_truncate(inode); |
438 | inode->i_size = 0; | ||
439 | fat_truncate(inode); | ||
440 | } | ||
441 | clear_inode(inode); | 438 | clear_inode(inode); |
442 | } | 439 | } |
443 | 440 | ||
@@ -445,8 +442,6 @@ static void fat_clear_inode(struct inode *inode) | |||
445 | { | 442 | { |
446 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 443 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
447 | 444 | ||
448 | if (is_bad_inode(inode)) | ||
449 | return; | ||
450 | lock_kernel(); | 445 | lock_kernel(); |
451 | spin_lock(&sbi->inode_hash_lock); | 446 | spin_lock(&sbi->inode_hash_lock); |
452 | fat_cache_inval_inode(inode); | 447 | fat_cache_inval_inode(inode); |
@@ -542,7 +537,7 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
542 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); | 537 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); |
543 | 538 | ||
544 | /* If the count of free cluster is still unknown, counts it here. */ | 539 | /* If the count of free cluster is still unknown, counts it here. */ |
545 | if (sbi->free_clusters == -1) { | 540 | if (sbi->free_clusters == -1 || !sbi->free_clus_valid) { |
546 | int err = fat_count_free_clusters(dentry->d_sb); | 541 | int err = fat_count_free_clusters(dentry->d_sb); |
547 | if (err) | 542 | if (err) |
548 | return err; | 543 | return err; |
@@ -790,6 +785,8 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
790 | seq_printf(m, ",gid=%u", opts->fs_gid); | 785 | seq_printf(m, ",gid=%u", opts->fs_gid); |
791 | seq_printf(m, ",fmask=%04o", opts->fs_fmask); | 786 | seq_printf(m, ",fmask=%04o", opts->fs_fmask); |
792 | seq_printf(m, ",dmask=%04o", opts->fs_dmask); | 787 | seq_printf(m, ",dmask=%04o", opts->fs_dmask); |
788 | if (opts->allow_utime) | ||
789 | seq_printf(m, ",allow_utime=%04o", opts->allow_utime); | ||
793 | if (sbi->nls_disk) | 790 | if (sbi->nls_disk) |
794 | seq_printf(m, ",codepage=%s", sbi->nls_disk->charset); | 791 | seq_printf(m, ",codepage=%s", sbi->nls_disk->charset); |
795 | if (isvfat) { | 792 | if (isvfat) { |
@@ -845,9 +842,9 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
845 | 842 | ||
846 | enum { | 843 | enum { |
847 | Opt_check_n, Opt_check_r, Opt_check_s, Opt_uid, Opt_gid, | 844 | Opt_check_n, Opt_check_r, Opt_check_s, Opt_uid, Opt_gid, |
848 | Opt_umask, Opt_dmask, Opt_fmask, Opt_codepage, Opt_usefree, Opt_nocase, | 845 | Opt_umask, Opt_dmask, Opt_fmask, Opt_allow_utime, Opt_codepage, |
849 | Opt_quiet, Opt_showexec, Opt_debug, Opt_immutable, | 846 | Opt_usefree, Opt_nocase, Opt_quiet, Opt_showexec, Opt_debug, |
850 | Opt_dots, Opt_nodots, | 847 | Opt_immutable, Opt_dots, Opt_nodots, |
851 | Opt_charset, Opt_shortname_lower, Opt_shortname_win95, | 848 | Opt_charset, Opt_shortname_lower, Opt_shortname_win95, |
852 | Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, | 849 | Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, |
853 | Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, | 850 | Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, |
@@ -866,6 +863,7 @@ static match_table_t fat_tokens = { | |||
866 | {Opt_umask, "umask=%o"}, | 863 | {Opt_umask, "umask=%o"}, |
867 | {Opt_dmask, "dmask=%o"}, | 864 | {Opt_dmask, "dmask=%o"}, |
868 | {Opt_fmask, "fmask=%o"}, | 865 | {Opt_fmask, "fmask=%o"}, |
866 | {Opt_allow_utime, "allow_utime=%o"}, | ||
869 | {Opt_codepage, "codepage=%u"}, | 867 | {Opt_codepage, "codepage=%u"}, |
870 | {Opt_usefree, "usefree"}, | 868 | {Opt_usefree, "usefree"}, |
871 | {Opt_nocase, "nocase"}, | 869 | {Opt_nocase, "nocase"}, |
@@ -937,6 +935,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug, | |||
937 | opts->fs_uid = current->uid; | 935 | opts->fs_uid = current->uid; |
938 | opts->fs_gid = current->gid; | 936 | opts->fs_gid = current->gid; |
939 | opts->fs_fmask = opts->fs_dmask = current->fs->umask; | 937 | opts->fs_fmask = opts->fs_dmask = current->fs->umask; |
938 | opts->allow_utime = -1; | ||
940 | opts->codepage = fat_default_codepage; | 939 | opts->codepage = fat_default_codepage; |
941 | opts->iocharset = fat_default_iocharset; | 940 | opts->iocharset = fat_default_iocharset; |
942 | if (is_vfat) | 941 | if (is_vfat) |
@@ -1024,6 +1023,11 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug, | |||
1024 | return 0; | 1023 | return 0; |
1025 | opts->fs_fmask = option; | 1024 | opts->fs_fmask = option; |
1026 | break; | 1025 | break; |
1026 | case Opt_allow_utime: | ||
1027 | if (match_octal(&args[0], &option)) | ||
1028 | return 0; | ||
1029 | opts->allow_utime = option & (S_IWGRP | S_IWOTH); | ||
1030 | break; | ||
1027 | case Opt_codepage: | 1031 | case Opt_codepage: |
1028 | if (match_int(&args[0], &option)) | 1032 | if (match_int(&args[0], &option)) |
1029 | return 0; | 1033 | return 0; |
@@ -1106,6 +1110,9 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug, | |||
1106 | " for FAT filesystems, filesystem will be case sensitive!\n"); | 1110 | " for FAT filesystems, filesystem will be case sensitive!\n"); |
1107 | } | 1111 | } |
1108 | 1112 | ||
1113 | /* If user doesn't specify allow_utime, it's initialized from dmask. */ | ||
1114 | if (opts->allow_utime == (unsigned short)-1) | ||
1115 | opts->allow_utime = ~opts->fs_dmask & (S_IWGRP | S_IWOTH); | ||
1109 | if (opts->unicode_xlate) | 1116 | if (opts->unicode_xlate) |
1110 | opts->utf8 = 0; | 1117 | opts->utf8 = 0; |
1111 | 1118 | ||
@@ -1208,7 +1215,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1208 | */ | 1215 | */ |
1209 | 1216 | ||
1210 | media = b->media; | 1217 | media = b->media; |
1211 | if (!FAT_VALID_MEDIA(media)) { | 1218 | if (!fat_valid_media(media)) { |
1212 | if (!silent) | 1219 | if (!silent) |
1213 | printk(KERN_ERR "FAT: invalid media value (0x%02x)\n", | 1220 | printk(KERN_ERR "FAT: invalid media value (0x%02x)\n", |
1214 | media); | 1221 | media); |
@@ -1219,7 +1226,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1219 | le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); | 1226 | le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); |
1220 | if (!is_power_of_2(logical_sector_size) | 1227 | if (!is_power_of_2(logical_sector_size) |
1221 | || (logical_sector_size < 512) | 1228 | || (logical_sector_size < 512) |
1222 | || (PAGE_CACHE_SIZE < logical_sector_size)) { | 1229 | || (logical_sector_size > 4096)) { |
1223 | if (!silent) | 1230 | if (!silent) |
1224 | printk(KERN_ERR "FAT: bogus logical sector size %u\n", | 1231 | printk(KERN_ERR "FAT: bogus logical sector size %u\n", |
1225 | logical_sector_size); | 1232 | logical_sector_size); |
@@ -1267,6 +1274,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1267 | sbi->fat_length = le16_to_cpu(b->fat_length); | 1274 | sbi->fat_length = le16_to_cpu(b->fat_length); |
1268 | sbi->root_cluster = 0; | 1275 | sbi->root_cluster = 0; |
1269 | sbi->free_clusters = -1; /* Don't know yet */ | 1276 | sbi->free_clusters = -1; /* Don't know yet */ |
1277 | sbi->free_clus_valid = 0; | ||
1270 | sbi->prev_free = FAT_START_ENT; | 1278 | sbi->prev_free = FAT_START_ENT; |
1271 | 1279 | ||
1272 | if (!sbi->fat_length && b->fat32_length) { | 1280 | if (!sbi->fat_length && b->fat32_length) { |
@@ -1302,8 +1310,8 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1302 | sbi->fsinfo_sector); | 1310 | sbi->fsinfo_sector); |
1303 | } else { | 1311 | } else { |
1304 | if (sbi->options.usefree) | 1312 | if (sbi->options.usefree) |
1305 | sbi->free_clusters = | 1313 | sbi->free_clus_valid = 1; |
1306 | le32_to_cpu(fsinfo->free_clusters); | 1314 | sbi->free_clusters = le32_to_cpu(fsinfo->free_clusters); |
1307 | sbi->prev_free = le32_to_cpu(fsinfo->next_cluster); | 1315 | sbi->prev_free = le32_to_cpu(fsinfo->next_cluster); |
1308 | } | 1316 | } |
1309 | 1317 | ||
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 90a04a6e3789..f55394e57cb2 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -438,7 +438,7 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | |||
438 | int error; | 438 | int error; |
439 | 439 | ||
440 | /* | 440 | /* |
441 | * Due to the order of unstuffing files and ->nopage(), we can be | 441 | * Due to the order of unstuffing files and ->fault(), we can be |
442 | * asked for a zero page in the case of a stuffed file being extended, | 442 | * asked for a zero page in the case of a stuffed file being extended, |
443 | * so we need to supply one here. It doesn't happen often. | 443 | * so we need to supply one here. It doesn't happen often. |
444 | */ | 444 | */ |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 6846785fe904..9783723e8ffe 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -504,7 +504,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
504 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 504 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
505 | INIT_LIST_HEAD(&inode->i_mapping->private_list); | 505 | INIT_LIST_HEAD(&inode->i_mapping->private_list); |
506 | info = HUGETLBFS_I(inode); | 506 | info = HUGETLBFS_I(inode); |
507 | mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, NULL); | 507 | mpol_shared_policy_init(&info->policy, NULL); |
508 | switch (mode & S_IFMT) { | 508 | switch (mode & S_IFMT) { |
509 | default: | 509 | default: |
510 | init_special_inode(inode, mode, dev); | 510 | init_special_inode(inode, mode, dev); |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index a38c7186c570..cd931ef1f000 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -407,22 +407,6 @@ void journal_commit_transaction(journal_t *journal) | |||
407 | jbd_debug (3, "JBD: commit phase 2\n"); | 407 | jbd_debug (3, "JBD: commit phase 2\n"); |
408 | 408 | ||
409 | /* | 409 | /* |
410 | * First, drop modified flag: all accesses to the buffers | ||
411 | * will be tracked for a new trasaction only -bzzz | ||
412 | */ | ||
413 | spin_lock(&journal->j_list_lock); | ||
414 | if (commit_transaction->t_buffers) { | ||
415 | new_jh = jh = commit_transaction->t_buffers->b_tnext; | ||
416 | do { | ||
417 | J_ASSERT_JH(new_jh, new_jh->b_modified == 1 || | ||
418 | new_jh->b_modified == 0); | ||
419 | new_jh->b_modified = 0; | ||
420 | new_jh = new_jh->b_tnext; | ||
421 | } while (new_jh != jh); | ||
422 | } | ||
423 | spin_unlock(&journal->j_list_lock); | ||
424 | |||
425 | /* | ||
426 | * Now start flushing things to disk, in the order they appear | 410 | * Now start flushing things to disk, in the order they appear |
427 | * on the transaction lists. Data blocks go first. | 411 | * on the transaction lists. Data blocks go first. |
428 | */ | 412 | */ |
@@ -488,6 +472,9 @@ void journal_commit_transaction(journal_t *journal) | |||
488 | */ | 472 | */ |
489 | commit_transaction->t_state = T_COMMIT; | 473 | commit_transaction->t_state = T_COMMIT; |
490 | 474 | ||
475 | J_ASSERT(commit_transaction->t_nr_buffers <= | ||
476 | commit_transaction->t_outstanding_credits); | ||
477 | |||
491 | descriptor = NULL; | 478 | descriptor = NULL; |
492 | bufs = 0; | 479 | bufs = 0; |
493 | while (commit_transaction->t_buffers) { | 480 | while (commit_transaction->t_buffers) { |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 0e081d5f32e8..b99c3b3654c4 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -534,7 +534,7 @@ int log_wait_commit(journal_t *journal, tid_t tid) | |||
534 | if (!tid_geq(journal->j_commit_request, tid)) { | 534 | if (!tid_geq(journal->j_commit_request, tid)) { |
535 | printk(KERN_EMERG | 535 | printk(KERN_EMERG |
536 | "%s: error: j_commit_request=%d, tid=%d\n", | 536 | "%s: error: j_commit_request=%d, tid=%d\n", |
537 | __FUNCTION__, journal->j_commit_request, tid); | 537 | __func__, journal->j_commit_request, tid); |
538 | } | 538 | } |
539 | spin_unlock(&journal->j_state_lock); | 539 | spin_unlock(&journal->j_state_lock); |
540 | #endif | 540 | #endif |
@@ -599,7 +599,7 @@ int journal_bmap(journal_t *journal, unsigned long blocknr, | |||
599 | 599 | ||
600 | printk(KERN_ALERT "%s: journal block not found " | 600 | printk(KERN_ALERT "%s: journal block not found " |
601 | "at offset %lu on %s\n", | 601 | "at offset %lu on %s\n", |
602 | __FUNCTION__, | 602 | __func__, |
603 | blocknr, | 603 | blocknr, |
604 | bdevname(journal->j_dev, b)); | 604 | bdevname(journal->j_dev, b)); |
605 | err = -EIO; | 605 | err = -EIO; |
@@ -728,7 +728,7 @@ journal_t * journal_init_dev(struct block_device *bdev, | |||
728 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); | 728 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); |
729 | if (!journal->j_wbuf) { | 729 | if (!journal->j_wbuf) { |
730 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", | 730 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", |
731 | __FUNCTION__); | 731 | __func__); |
732 | kfree(journal); | 732 | kfree(journal); |
733 | journal = NULL; | 733 | journal = NULL; |
734 | goto out; | 734 | goto out; |
@@ -782,7 +782,7 @@ journal_t * journal_init_inode (struct inode *inode) | |||
782 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); | 782 | journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL); |
783 | if (!journal->j_wbuf) { | 783 | if (!journal->j_wbuf) { |
784 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", | 784 | printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n", |
785 | __FUNCTION__); | 785 | __func__); |
786 | kfree(journal); | 786 | kfree(journal); |
787 | return NULL; | 787 | return NULL; |
788 | } | 788 | } |
@@ -791,7 +791,7 @@ journal_t * journal_init_inode (struct inode *inode) | |||
791 | /* If that failed, give up */ | 791 | /* If that failed, give up */ |
792 | if (err) { | 792 | if (err) { |
793 | printk(KERN_ERR "%s: Cannnot locate journal superblock\n", | 793 | printk(KERN_ERR "%s: Cannnot locate journal superblock\n", |
794 | __FUNCTION__); | 794 | __func__); |
795 | kfree(journal); | 795 | kfree(journal); |
796 | return NULL; | 796 | return NULL; |
797 | } | 797 | } |
@@ -877,7 +877,7 @@ int journal_create(journal_t *journal) | |||
877 | */ | 877 | */ |
878 | printk(KERN_EMERG | 878 | printk(KERN_EMERG |
879 | "%s: creation of journal on external device!\n", | 879 | "%s: creation of journal on external device!\n", |
880 | __FUNCTION__); | 880 | __func__); |
881 | BUG(); | 881 | BUG(); |
882 | } | 882 | } |
883 | 883 | ||
@@ -1657,7 +1657,7 @@ static struct journal_head *journal_alloc_journal_head(void) | |||
1657 | jbd_debug(1, "out of memory for journal_head\n"); | 1657 | jbd_debug(1, "out of memory for journal_head\n"); |
1658 | if (time_after(jiffies, last_warning + 5*HZ)) { | 1658 | if (time_after(jiffies, last_warning + 5*HZ)) { |
1659 | printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", | 1659 | printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", |
1660 | __FUNCTION__); | 1660 | __func__); |
1661 | last_warning = jiffies; | 1661 | last_warning = jiffies; |
1662 | } | 1662 | } |
1663 | while (ret == NULL) { | 1663 | while (ret == NULL) { |
@@ -1794,13 +1794,13 @@ static void __journal_remove_journal_head(struct buffer_head *bh) | |||
1794 | if (jh->b_frozen_data) { | 1794 | if (jh->b_frozen_data) { |
1795 | printk(KERN_WARNING "%s: freeing " | 1795 | printk(KERN_WARNING "%s: freeing " |
1796 | "b_frozen_data\n", | 1796 | "b_frozen_data\n", |
1797 | __FUNCTION__); | 1797 | __func__); |
1798 | jbd_free(jh->b_frozen_data, bh->b_size); | 1798 | jbd_free(jh->b_frozen_data, bh->b_size); |
1799 | } | 1799 | } |
1800 | if (jh->b_committed_data) { | 1800 | if (jh->b_committed_data) { |
1801 | printk(KERN_WARNING "%s: freeing " | 1801 | printk(KERN_WARNING "%s: freeing " |
1802 | "b_committed_data\n", | 1802 | "b_committed_data\n", |
1803 | __FUNCTION__); | 1803 | __func__); |
1804 | jbd_free(jh->b_committed_data, bh->b_size); | 1804 | jbd_free(jh->b_committed_data, bh->b_size); |
1805 | } | 1805 | } |
1806 | bh->b_private = NULL; | 1806 | bh->b_private = NULL; |
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index d5f8eee7c88c..1bb43e987f4b 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
@@ -138,7 +138,7 @@ repeat: | |||
138 | oom: | 138 | oom: |
139 | if (!journal_oom_retry) | 139 | if (!journal_oom_retry) |
140 | return -ENOMEM; | 140 | return -ENOMEM; |
141 | jbd_debug(1, "ENOMEM in %s, retrying\n", __FUNCTION__); | 141 | jbd_debug(1, "ENOMEM in %s, retrying\n", __func__); |
142 | yield(); | 142 | yield(); |
143 | goto repeat; | 143 | goto repeat; |
144 | } | 144 | } |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 2c9e8f5d13aa..67ff2024c23c 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -609,6 +609,12 @@ repeat: | |||
609 | goto done; | 609 | goto done; |
610 | 610 | ||
611 | /* | 611 | /* |
612 | * this is the first time this transaction is touching this buffer, | ||
613 | * reset the modified flag | ||
614 | */ | ||
615 | jh->b_modified = 0; | ||
616 | |||
617 | /* | ||
612 | * If there is already a copy-out version of this buffer, then we don't | 618 | * If there is already a copy-out version of this buffer, then we don't |
613 | * need to make another one | 619 | * need to make another one |
614 | */ | 620 | */ |
@@ -681,7 +687,7 @@ repeat: | |||
681 | if (!frozen_buffer) { | 687 | if (!frozen_buffer) { |
682 | printk(KERN_EMERG | 688 | printk(KERN_EMERG |
683 | "%s: OOM for frozen_buffer\n", | 689 | "%s: OOM for frozen_buffer\n", |
684 | __FUNCTION__); | 690 | __func__); |
685 | JBUFFER_TRACE(jh, "oom!"); | 691 | JBUFFER_TRACE(jh, "oom!"); |
686 | error = -ENOMEM; | 692 | error = -ENOMEM; |
687 | jbd_lock_bh_state(bh); | 693 | jbd_lock_bh_state(bh); |
@@ -820,9 +826,16 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
820 | 826 | ||
821 | if (jh->b_transaction == NULL) { | 827 | if (jh->b_transaction == NULL) { |
822 | jh->b_transaction = transaction; | 828 | jh->b_transaction = transaction; |
829 | |||
830 | /* first access by this transaction */ | ||
831 | jh->b_modified = 0; | ||
832 | |||
823 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); | 833 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); |
824 | __journal_file_buffer(jh, transaction, BJ_Reserved); | 834 | __journal_file_buffer(jh, transaction, BJ_Reserved); |
825 | } else if (jh->b_transaction == journal->j_committing_transaction) { | 835 | } else if (jh->b_transaction == journal->j_committing_transaction) { |
836 | /* first access by this transaction */ | ||
837 | jh->b_modified = 0; | ||
838 | |||
826 | JBUFFER_TRACE(jh, "set next transaction"); | 839 | JBUFFER_TRACE(jh, "set next transaction"); |
827 | jh->b_next_transaction = transaction; | 840 | jh->b_next_transaction = transaction; |
828 | } | 841 | } |
@@ -891,7 +904,7 @@ repeat: | |||
891 | committed_data = jbd_alloc(jh2bh(jh)->b_size, GFP_NOFS); | 904 | committed_data = jbd_alloc(jh2bh(jh)->b_size, GFP_NOFS); |
892 | if (!committed_data) { | 905 | if (!committed_data) { |
893 | printk(KERN_EMERG "%s: No memory for committed data\n", | 906 | printk(KERN_EMERG "%s: No memory for committed data\n", |
894 | __FUNCTION__); | 907 | __func__); |
895 | err = -ENOMEM; | 908 | err = -ENOMEM; |
896 | goto out; | 909 | goto out; |
897 | } | 910 | } |
@@ -1222,6 +1235,7 @@ int journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1222 | struct journal_head *jh; | 1235 | struct journal_head *jh; |
1223 | int drop_reserve = 0; | 1236 | int drop_reserve = 0; |
1224 | int err = 0; | 1237 | int err = 0; |
1238 | int was_modified = 0; | ||
1225 | 1239 | ||
1226 | BUFFER_TRACE(bh, "entry"); | 1240 | BUFFER_TRACE(bh, "entry"); |
1227 | 1241 | ||
@@ -1240,6 +1254,9 @@ int journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1240 | goto not_jbd; | 1254 | goto not_jbd; |
1241 | } | 1255 | } |
1242 | 1256 | ||
1257 | /* keep track of wether or not this transaction modified us */ | ||
1258 | was_modified = jh->b_modified; | ||
1259 | |||
1243 | /* | 1260 | /* |
1244 | * The buffer's going from the transaction, we must drop | 1261 | * The buffer's going from the transaction, we must drop |
1245 | * all references -bzzz | 1262 | * all references -bzzz |
@@ -1257,7 +1274,12 @@ int journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1257 | 1274 | ||
1258 | JBUFFER_TRACE(jh, "belongs to current transaction: unfile"); | 1275 | JBUFFER_TRACE(jh, "belongs to current transaction: unfile"); |
1259 | 1276 | ||
1260 | drop_reserve = 1; | 1277 | /* |
1278 | * we only want to drop a reference if this transaction | ||
1279 | * modified the buffer | ||
1280 | */ | ||
1281 | if (was_modified) | ||
1282 | drop_reserve = 1; | ||
1261 | 1283 | ||
1262 | /* | 1284 | /* |
1263 | * We are no longer going to journal this buffer. | 1285 | * We are no longer going to journal this buffer. |
@@ -1297,7 +1319,13 @@ int journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1297 | if (jh->b_next_transaction) { | 1319 | if (jh->b_next_transaction) { |
1298 | J_ASSERT(jh->b_next_transaction == transaction); | 1320 | J_ASSERT(jh->b_next_transaction == transaction); |
1299 | jh->b_next_transaction = NULL; | 1321 | jh->b_next_transaction = NULL; |
1300 | drop_reserve = 1; | 1322 | |
1323 | /* | ||
1324 | * only drop a reference if this transaction modified | ||
1325 | * the buffer | ||
1326 | */ | ||
1327 | if (was_modified) | ||
1328 | drop_reserve = 1; | ||
1301 | } | 1329 | } |
1302 | } | 1330 | } |
1303 | 1331 | ||
@@ -2069,7 +2097,7 @@ void __journal_refile_buffer(struct journal_head *jh) | |||
2069 | jh->b_transaction = jh->b_next_transaction; | 2097 | jh->b_transaction = jh->b_next_transaction; |
2070 | jh->b_next_transaction = NULL; | 2098 | jh->b_next_transaction = NULL; |
2071 | __journal_file_buffer(jh, jh->b_transaction, | 2099 | __journal_file_buffer(jh, jh->b_transaction, |
2072 | was_dirty ? BJ_Metadata : BJ_Reserved); | 2100 | jh->b_modified ? BJ_Metadata : BJ_Reserved); |
2073 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); | 2101 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); |
2074 | 2102 | ||
2075 | if (was_dirty) | 2103 | if (was_dirty) |
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c index 30f7d0ae2215..2d4358c59f68 100644 --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c | |||
@@ -653,7 +653,7 @@ static const struct inode_operations msdos_dir_inode_operations = { | |||
653 | .mkdir = msdos_mkdir, | 653 | .mkdir = msdos_mkdir, |
654 | .rmdir = msdos_rmdir, | 654 | .rmdir = msdos_rmdir, |
655 | .rename = msdos_rename, | 655 | .rename = msdos_rename, |
656 | .setattr = fat_notify_change, | 656 | .setattr = fat_setattr, |
657 | .getattr = fat_getattr, | 657 | .getattr = fat_getattr, |
658 | }; | 658 | }; |
659 | 659 | ||
diff --git a/fs/namespace.c b/fs/namespace.c index f48f98110c30..fe376805cf5f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/quotaops.h> | ||
18 | #include <linux/acct.h> | 17 | #include <linux/acct.h> |
19 | #include <linux/capability.h> | 18 | #include <linux/capability.h> |
20 | #include <linux/cpumask.h> | 19 | #include <linux/cpumask.h> |
@@ -1084,7 +1083,6 @@ static int do_umount(struct vfsmount *mnt, int flags) | |||
1084 | down_write(&sb->s_umount); | 1083 | down_write(&sb->s_umount); |
1085 | if (!(sb->s_flags & MS_RDONLY)) { | 1084 | if (!(sb->s_flags & MS_RDONLY)) { |
1086 | lock_kernel(); | 1085 | lock_kernel(); |
1087 | DQUOT_OFF(sb); | ||
1088 | retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); | 1086 | retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); |
1089 | unlock_kernel(); | 1087 | unlock_kernel(); |
1090 | } | 1088 | } |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index fbbb9f7afa1a..2e5ab1204dec 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -107,12 +107,6 @@ static const struct super_operations ncp_sops = | |||
107 | .show_options = ncp_show_options, | 107 | .show_options = ncp_show_options, |
108 | }; | 108 | }; |
109 | 109 | ||
110 | extern struct dentry_operations ncp_root_dentry_operations; | ||
111 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) | ||
112 | extern const struct address_space_operations ncp_symlink_aops; | ||
113 | extern int ncp_symlink(struct inode*, struct dentry*, const char*); | ||
114 | #endif | ||
115 | |||
116 | /* | 110 | /* |
117 | * Fill in the ncpfs-specific information in the inode. | 111 | * Fill in the ncpfs-specific information in the inode. |
118 | */ | 112 | */ |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index ad8f167e54bc..3a97c95e1ca2 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -389,11 +389,11 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp, | |||
389 | struct dentry* dentry = inode->i_sb->s_root; | 389 | struct dentry* dentry = inode->i_sb->s_root; |
390 | 390 | ||
391 | if (dentry) { | 391 | if (dentry) { |
392 | struct inode* inode = dentry->d_inode; | 392 | struct inode* s_inode = dentry->d_inode; |
393 | 393 | ||
394 | if (inode) { | 394 | if (s_inode) { |
395 | sr.volNumber = NCP_FINFO(inode)->volNumber; | 395 | sr.volNumber = NCP_FINFO(s_inode)->volNumber; |
396 | sr.dirEntNum = NCP_FINFO(inode)->dirEntNum; | 396 | sr.dirEntNum = NCP_FINFO(s_inode)->dirEntNum; |
397 | sr.namespace = server->name_space[sr.volNumber]; | 397 | sr.namespace = server->name_space[sr.volNumber]; |
398 | } else | 398 | } else |
399 | DPRINTK("ncpfs: s_root->d_inode==NULL\n"); | 399 | DPRINTK("ncpfs: s_root->d_inode==NULL\n"); |
@@ -439,12 +439,12 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp, | |||
439 | dentry = inode->i_sb->s_root; | 439 | dentry = inode->i_sb->s_root; |
440 | server->root_setuped = 1; | 440 | server->root_setuped = 1; |
441 | if (dentry) { | 441 | if (dentry) { |
442 | struct inode* inode = dentry->d_inode; | 442 | struct inode* s_inode = dentry->d_inode; |
443 | 443 | ||
444 | if (inode) { | 444 | if (inode) { |
445 | NCP_FINFO(inode)->volNumber = vnum; | 445 | NCP_FINFO(s_inode)->volNumber = vnum; |
446 | NCP_FINFO(inode)->dirEntNum = de; | 446 | NCP_FINFO(s_inode)->dirEntNum = de; |
447 | NCP_FINFO(inode)->DosDirNum = dosde; | 447 | NCP_FINFO(s_inode)->DosDirNum = dosde; |
448 | } else | 448 | } else |
449 | DPRINTK("ncpfs: s_root->d_inode==NULL\n"); | 449 | DPRINTK("ncpfs: s_root->d_inode==NULL\n"); |
450 | } else | 450 | } else |
@@ -519,7 +519,6 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp, | |||
519 | } | 519 | } |
520 | { | 520 | { |
521 | struct ncp_lock_ioctl rqdata; | 521 | struct ncp_lock_ioctl rqdata; |
522 | int result; | ||
523 | 522 | ||
524 | if (copy_from_user(&rqdata, argp, sizeof(rqdata))) | 523 | if (copy_from_user(&rqdata, argp, sizeof(rqdata))) |
525 | return -EFAULT; | 524 | return -EFAULT; |
diff --git a/fs/ncpfs/ncpsign_kernel.c b/fs/ncpfs/ncpsign_kernel.c index 749a18d33599..7c0b5c21e6cf 100644 --- a/fs/ncpfs/ncpsign_kernel.c +++ b/fs/ncpfs/ncpsign_kernel.c | |||
@@ -55,7 +55,7 @@ static void nwsign(char *r_data1, char *r_data2, char *outdata) { | |||
55 | unsigned int w0,w1,w2,w3; | 55 | unsigned int w0,w1,w2,w3; |
56 | static int rbit[4]={0, 2, 1, 3}; | 56 | static int rbit[4]={0, 2, 1, 3}; |
57 | #ifdef __i386__ | 57 | #ifdef __i386__ |
58 | unsigned int *data2=(int *)r_data2; | 58 | unsigned int *data2=(unsigned int *)r_data2; |
59 | #else | 59 | #else |
60 | unsigned int data2[16]; | 60 | unsigned int data2[16]; |
61 | for (i=0;i<16;i++) | 61 | for (i=0;i<16;i++) |
@@ -837,7 +837,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, | |||
837 | if (f->f_flags & O_DIRECT) { | 837 | if (f->f_flags & O_DIRECT) { |
838 | if (!f->f_mapping->a_ops || | 838 | if (!f->f_mapping->a_ops || |
839 | ((!f->f_mapping->a_ops->direct_IO) && | 839 | ((!f->f_mapping->a_ops->direct_IO) && |
840 | (!f->f_mapping->a_ops->get_xip_page))) { | 840 | (!f->f_mapping->a_ops->get_xip_mem))) { |
841 | fput(f); | 841 | fput(f); |
842 | f = ERR_PTR(-EINVAL); | 842 | f = ERR_PTR(-EINVAL); |
843 | } | 843 | } |
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 5567ec0d03a3..796511886f28 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * | 18 | * |
19 | * Re-organised Feb 1998 Russell King | 19 | * Re-organised Feb 1998 Russell King |
20 | */ | 20 | */ |
21 | 21 | #include <linux/msdos_fs.h> | |
22 | 22 | ||
23 | #include "check.h" | 23 | #include "check.h" |
24 | #include "msdos.h" | 24 | #include "msdos.h" |
@@ -419,6 +419,7 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
419 | Sector sect; | 419 | Sector sect; |
420 | unsigned char *data; | 420 | unsigned char *data; |
421 | struct partition *p; | 421 | struct partition *p; |
422 | struct fat_boot_sector *fb; | ||
422 | int slot; | 423 | int slot; |
423 | 424 | ||
424 | data = read_dev_sector(bdev, 0, §); | 425 | data = read_dev_sector(bdev, 0, §); |
@@ -444,8 +445,21 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
444 | p = (struct partition *) (data + 0x1be); | 445 | p = (struct partition *) (data + 0x1be); |
445 | for (slot = 1; slot <= 4; slot++, p++) { | 446 | for (slot = 1; slot <= 4; slot++, p++) { |
446 | if (p->boot_ind != 0 && p->boot_ind != 0x80) { | 447 | if (p->boot_ind != 0 && p->boot_ind != 0x80) { |
447 | put_dev_sector(sect); | 448 | /* |
448 | return 0; | 449 | * Even without a valid boot inidicator value |
450 | * its still possible this is valid FAT filesystem | ||
451 | * without a partition table. | ||
452 | */ | ||
453 | fb = (struct fat_boot_sector *) data; | ||
454 | if (slot == 1 && fb->reserved && fb->fats | ||
455 | && fat_valid_media(fb->media)) { | ||
456 | printk("\n"); | ||
457 | put_dev_sector(sect); | ||
458 | return 1; | ||
459 | } else { | ||
460 | put_dev_sector(sect); | ||
461 | return 0; | ||
462 | } | ||
449 | } | 463 | } |
450 | } | 464 | } |
451 | 465 | ||
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 2d563979cb02..441a32f0e5f2 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -456,6 +456,20 @@ static const struct file_operations proc_slabstats_operations = { | |||
456 | #endif | 456 | #endif |
457 | #endif | 457 | #endif |
458 | 458 | ||
459 | #ifdef CONFIG_MMU | ||
460 | static int vmalloc_open(struct inode *inode, struct file *file) | ||
461 | { | ||
462 | return seq_open(file, &vmalloc_op); | ||
463 | } | ||
464 | |||
465 | static const struct file_operations proc_vmalloc_operations = { | ||
466 | .open = vmalloc_open, | ||
467 | .read = seq_read, | ||
468 | .llseek = seq_lseek, | ||
469 | .release = seq_release, | ||
470 | }; | ||
471 | #endif | ||
472 | |||
459 | static int show_stat(struct seq_file *p, void *v) | 473 | static int show_stat(struct seq_file *p, void *v) |
460 | { | 474 | { |
461 | int i; | 475 | int i; |
@@ -869,6 +883,9 @@ void __init proc_misc_init(void) | |||
869 | create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); | 883 | create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); |
870 | #endif | 884 | #endif |
871 | #endif | 885 | #endif |
886 | #ifdef CONFIG_MMU | ||
887 | proc_create("vmallocinfo", S_IRUSR, NULL, &proc_vmalloc_operations); | ||
888 | #endif | ||
872 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 889 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
873 | create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops); | 890 | create_seq_entry("pagetypeinfo", S_IRUGO, &pagetypeinfo_file_ops); |
874 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 891 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 9dfb5ff24209..7415eeb7cc3a 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -338,8 +338,7 @@ const struct file_operations proc_maps_operations = { | |||
338 | #define PSS_SHIFT 12 | 338 | #define PSS_SHIFT 12 |
339 | 339 | ||
340 | #ifdef CONFIG_PROC_PAGE_MONITOR | 340 | #ifdef CONFIG_PROC_PAGE_MONITOR |
341 | struct mem_size_stats | 341 | struct mem_size_stats { |
342 | { | ||
343 | struct vm_area_struct *vma; | 342 | struct vm_area_struct *vma; |
344 | unsigned long resident; | 343 | unsigned long resident; |
345 | unsigned long shared_clean; | 344 | unsigned long shared_clean; |
@@ -347,6 +346,7 @@ struct mem_size_stats | |||
347 | unsigned long private_clean; | 346 | unsigned long private_clean; |
348 | unsigned long private_dirty; | 347 | unsigned long private_dirty; |
349 | unsigned long referenced; | 348 | unsigned long referenced; |
349 | unsigned long swap; | ||
350 | u64 pss; | 350 | u64 pss; |
351 | }; | 351 | }; |
352 | 352 | ||
@@ -363,6 +363,12 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
363 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); | 363 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
364 | for (; addr != end; pte++, addr += PAGE_SIZE) { | 364 | for (; addr != end; pte++, addr += PAGE_SIZE) { |
365 | ptent = *pte; | 365 | ptent = *pte; |
366 | |||
367 | if (is_swap_pte(ptent)) { | ||
368 | mss->swap += PAGE_SIZE; | ||
369 | continue; | ||
370 | } | ||
371 | |||
366 | if (!pte_present(ptent)) | 372 | if (!pte_present(ptent)) |
367 | continue; | 373 | continue; |
368 | 374 | ||
@@ -421,7 +427,8 @@ static int show_smap(struct seq_file *m, void *v) | |||
421 | "Shared_Dirty: %8lu kB\n" | 427 | "Shared_Dirty: %8lu kB\n" |
422 | "Private_Clean: %8lu kB\n" | 428 | "Private_Clean: %8lu kB\n" |
423 | "Private_Dirty: %8lu kB\n" | 429 | "Private_Dirty: %8lu kB\n" |
424 | "Referenced: %8lu kB\n", | 430 | "Referenced: %8lu kB\n" |
431 | "Swap: %8lu kB\n", | ||
425 | (vma->vm_end - vma->vm_start) >> 10, | 432 | (vma->vm_end - vma->vm_start) >> 10, |
426 | mss.resident >> 10, | 433 | mss.resident >> 10, |
427 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), | 434 | (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), |
@@ -429,7 +436,8 @@ static int show_smap(struct seq_file *m, void *v) | |||
429 | mss.shared_dirty >> 10, | 436 | mss.shared_dirty >> 10, |
430 | mss.private_clean >> 10, | 437 | mss.private_clean >> 10, |
431 | mss.private_dirty >> 10, | 438 | mss.private_dirty >> 10, |
432 | mss.referenced >> 10); | 439 | mss.referenced >> 10, |
440 | mss.swap >> 10); | ||
433 | 441 | ||
434 | return ret; | 442 | return ret; |
435 | } | 443 | } |
@@ -579,7 +587,7 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end, | |||
579 | return err; | 587 | return err; |
580 | } | 588 | } |
581 | 589 | ||
582 | u64 swap_pte_to_pagemap_entry(pte_t pte) | 590 | static u64 swap_pte_to_pagemap_entry(pte_t pte) |
583 | { | 591 | { |
584 | swp_entry_t e = pte_to_swp_entry(pte); | 592 | swp_entry_t e = pte_to_swp_entry(pte); |
585 | return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT); | 593 | return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT); |
diff --git a/fs/quota.c b/fs/quota.c index 84f28dd72116..db1cc9f3c7aa 100644 --- a/fs/quota.c +++ b/fs/quota.c | |||
@@ -69,7 +69,6 @@ static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid | |||
69 | switch (cmd) { | 69 | switch (cmd) { |
70 | case Q_GETFMT: | 70 | case Q_GETFMT: |
71 | case Q_GETINFO: | 71 | case Q_GETINFO: |
72 | case Q_QUOTAOFF: | ||
73 | case Q_SETINFO: | 72 | case Q_SETINFO: |
74 | case Q_SETQUOTA: | 73 | case Q_SETQUOTA: |
75 | case Q_GETQUOTA: | 74 | case Q_GETQUOTA: |
@@ -229,12 +228,12 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, void | |||
229 | 228 | ||
230 | if (IS_ERR(pathname = getname(addr))) | 229 | if (IS_ERR(pathname = getname(addr))) |
231 | return PTR_ERR(pathname); | 230 | return PTR_ERR(pathname); |
232 | ret = sb->s_qcop->quota_on(sb, type, id, pathname); | 231 | ret = sb->s_qcop->quota_on(sb, type, id, pathname, 0); |
233 | putname(pathname); | 232 | putname(pathname); |
234 | return ret; | 233 | return ret; |
235 | } | 234 | } |
236 | case Q_QUOTAOFF: | 235 | case Q_QUOTAOFF: |
237 | return sb->s_qcop->quota_off(sb, type); | 236 | return sb->s_qcop->quota_off(sb, type, 0); |
238 | 237 | ||
239 | case Q_GETFMT: { | 238 | case Q_GETFMT: { |
240 | __u32 fmt; | 239 | __u32 fmt; |
diff --git a/fs/quota_v1.c b/fs/quota_v1.c index f3841f233069..a6cf9269105c 100644 --- a/fs/quota_v1.c +++ b/fs/quota_v1.c | |||
@@ -139,6 +139,9 @@ static int v1_read_file_info(struct super_block *sb, int type) | |||
139 | goto out; | 139 | goto out; |
140 | } | 140 | } |
141 | ret = 0; | 141 | ret = 0; |
142 | /* limits are stored as unsigned 32-bit data */ | ||
143 | dqopt->info[type].dqi_maxblimit = 0xffffffff; | ||
144 | dqopt->info[type].dqi_maxilimit = 0xffffffff; | ||
142 | dqopt->info[type].dqi_igrace = dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME; | 145 | dqopt->info[type].dqi_igrace = dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME; |
143 | dqopt->info[type].dqi_bgrace = dqblk.dqb_btime ? dqblk.dqb_btime : MAX_DQ_TIME; | 146 | dqopt->info[type].dqi_bgrace = dqblk.dqb_btime ? dqblk.dqb_btime : MAX_DQ_TIME; |
144 | out: | 147 | out: |
diff --git a/fs/quota_v2.c b/fs/quota_v2.c index c519a583e681..23b647f25d08 100644 --- a/fs/quota_v2.c +++ b/fs/quota_v2.c | |||
@@ -59,6 +59,9 @@ static int v2_read_file_info(struct super_block *sb, int type) | |||
59 | sb->s_id); | 59 | sb->s_id); |
60 | return -1; | 60 | return -1; |
61 | } | 61 | } |
62 | /* limits are stored as unsigned 32-bit data */ | ||
63 | info->dqi_maxblimit = 0xffffffff; | ||
64 | info->dqi_maxilimit = 0xffffffff; | ||
62 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); | 65 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); |
63 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); | 66 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); |
64 | info->dqi_flags = le32_to_cpu(dinfo.dqi_flags); | 67 | info->dqi_flags = le32_to_cpu(dinfo.dqi_flags); |
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index f491ceb5af02..4646caa60455 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -479,7 +479,7 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th, | |||
479 | if (ei->i_prealloc_count < 0) | 479 | if (ei->i_prealloc_count < 0) |
480 | reiserfs_warning(th->t_super, | 480 | reiserfs_warning(th->t_super, |
481 | "zam-4001:%s: inode has negative prealloc blocks count.", | 481 | "zam-4001:%s: inode has negative prealloc blocks count.", |
482 | __FUNCTION__); | 482 | __func__); |
483 | #endif | 483 | #endif |
484 | while (ei->i_prealloc_count > 0) { | 484 | while (ei->i_prealloc_count > 0) { |
485 | reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); | 485 | reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); |
@@ -517,7 +517,7 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th) | |||
517 | if (!ei->i_prealloc_count) { | 517 | if (!ei->i_prealloc_count) { |
518 | reiserfs_warning(th->t_super, | 518 | reiserfs_warning(th->t_super, |
519 | "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.", | 519 | "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.", |
520 | __FUNCTION__); | 520 | __func__); |
521 | } | 521 | } |
522 | #endif | 522 | #endif |
523 | __discard_prealloc(th, ei); | 523 | __discard_prealloc(th, ei); |
@@ -632,7 +632,7 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options) | |||
632 | } | 632 | } |
633 | 633 | ||
634 | reiserfs_warning(s, "zam-4001: %s : unknown option - %s", | 634 | reiserfs_warning(s, "zam-4001: %s : unknown option - %s", |
635 | __FUNCTION__, this_char); | 635 | __func__, this_char); |
636 | return 1; | 636 | return 1; |
637 | } | 637 | } |
638 | 638 | ||
@@ -1254,7 +1254,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, | |||
1254 | bh = sb_bread(sb, block); | 1254 | bh = sb_bread(sb, block); |
1255 | if (bh == NULL) | 1255 | if (bh == NULL) |
1256 | reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " | 1256 | reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " |
1257 | "reading failed", __FUNCTION__, block); | 1257 | "reading failed", __func__, block); |
1258 | else { | 1258 | else { |
1259 | if (buffer_locked(bh)) { | 1259 | if (buffer_locked(bh)) { |
1260 | PROC_INFO_INC(sb, scan_bitmap.wait); | 1260 | PROC_INFO_INC(sb, scan_bitmap.wait); |
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c index 7ee4208793b6..2f87f5b14630 100644 --- a/fs/reiserfs/do_balan.c +++ b/fs/reiserfs/do_balan.c | |||
@@ -1464,29 +1464,29 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
1464 | } else | 1464 | } else |
1465 | /* item falls wholly into S_new[i] */ | 1465 | /* item falls wholly into S_new[i] */ |
1466 | { | 1466 | { |
1467 | int ret_val; | 1467 | int leaf_mi; |
1468 | struct item_head *pasted; | 1468 | struct item_head *pasted; |
1469 | 1469 | ||
1470 | #ifdef CONFIG_REISERFS_CHECK | 1470 | #ifdef CONFIG_REISERFS_CHECK |
1471 | struct item_head *ih = | 1471 | struct item_head *ih_check = |
1472 | B_N_PITEM_HEAD(tbS0, item_pos); | 1472 | B_N_PITEM_HEAD(tbS0, item_pos); |
1473 | 1473 | ||
1474 | if (!is_direntry_le_ih(ih) | 1474 | if (!is_direntry_le_ih(ih_check) |
1475 | && (pos_in_item != ih_item_len(ih) | 1475 | && (pos_in_item != ih_item_len(ih_check) |
1476 | || tb->insert_size[0] <= 0)) | 1476 | || tb->insert_size[0] <= 0)) |
1477 | reiserfs_panic(tb->tb_sb, | 1477 | reiserfs_panic(tb->tb_sb, |
1478 | "PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len"); | 1478 | "PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len"); |
1479 | #endif /* CONFIG_REISERFS_CHECK */ | 1479 | #endif /* CONFIG_REISERFS_CHECK */ |
1480 | 1480 | ||
1481 | ret_val = | 1481 | leaf_mi = |
1482 | leaf_move_items(LEAF_FROM_S_TO_SNEW, | 1482 | leaf_move_items(LEAF_FROM_S_TO_SNEW, |
1483 | tb, snum[i], | 1483 | tb, snum[i], |
1484 | sbytes[i], | 1484 | sbytes[i], |
1485 | S_new[i]); | 1485 | S_new[i]); |
1486 | 1486 | ||
1487 | RFALSE(ret_val, | 1487 | RFALSE(leaf_mi, |
1488 | "PAP-12240: unexpected value returned by leaf_move_items (%d)", | 1488 | "PAP-12240: unexpected value returned by leaf_move_items (%d)", |
1489 | ret_val); | 1489 | leaf_mi); |
1490 | 1490 | ||
1491 | /* paste into item */ | 1491 | /* paste into item */ |
1492 | bi.tb = tb; | 1492 | bi.tb = tb; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 74363a7aacbc..830332021ed4 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
13 | #include <linux/compat.h> | 13 | #include <linux/compat.h> |
14 | 14 | ||
15 | static int reiserfs_unpack(struct inode *inode, struct file *filp); | ||
16 | |||
17 | /* | 15 | /* |
18 | ** reiserfs_ioctl - handler for ioctl for inode | 16 | ** reiserfs_ioctl - handler for ioctl for inode |
19 | ** supported commands: | 17 | ** supported commands: |
@@ -159,7 +157,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page, | |||
159 | ** Function try to convert tail from direct item into indirect. | 157 | ** Function try to convert tail from direct item into indirect. |
160 | ** It set up nopack attribute in the REISERFS_I(inode)->nopack | 158 | ** It set up nopack attribute in the REISERFS_I(inode)->nopack |
161 | */ | 159 | */ |
162 | static int reiserfs_unpack(struct inode *inode, struct file *filp) | 160 | int reiserfs_unpack(struct inode *inode, struct file *filp) |
163 | { | 161 | { |
164 | int retval = 0; | 162 | int retval = 0; |
165 | int index; | 163 | int index; |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 060eb3f598e7..da86042b3e03 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -1187,7 +1187,7 @@ static int flush_commit_list(struct super_block *s, | |||
1187 | 1187 | ||
1188 | if (retval) | 1188 | if (retval) |
1189 | reiserfs_abort(s, retval, "Journal write error in %s", | 1189 | reiserfs_abort(s, retval, "Journal write error in %s", |
1190 | __FUNCTION__); | 1190 | __func__); |
1191 | put_fs_excl(); | 1191 | put_fs_excl(); |
1192 | return retval; | 1192 | return retval; |
1193 | } | 1193 | } |
@@ -1534,7 +1534,7 @@ static int flush_journal_list(struct super_block *s, | |||
1534 | reiserfs_warning(s, | 1534 | reiserfs_warning(s, |
1535 | "clm-2082: Unable to flush buffer %llu in %s", | 1535 | "clm-2082: Unable to flush buffer %llu in %s", |
1536 | (unsigned long long)saved_bh-> | 1536 | (unsigned long long)saved_bh-> |
1537 | b_blocknr, __FUNCTION__); | 1537 | b_blocknr, __func__); |
1538 | } | 1538 | } |
1539 | free_cnode: | 1539 | free_cnode: |
1540 | last = cn; | 1540 | last = cn; |
@@ -1586,7 +1586,7 @@ static int flush_journal_list(struct super_block *s, | |||
1586 | if (err) | 1586 | if (err) |
1587 | reiserfs_abort(s, -EIO, | 1587 | reiserfs_abort(s, -EIO, |
1588 | "Write error while pushing transaction to disk in %s", | 1588 | "Write error while pushing transaction to disk in %s", |
1589 | __FUNCTION__); | 1589 | __func__); |
1590 | flush_older_and_return: | 1590 | flush_older_and_return: |
1591 | 1591 | ||
1592 | /* before we can update the journal header block, we _must_ flush all | 1592 | /* before we can update the journal header block, we _must_ flush all |
@@ -1616,7 +1616,7 @@ static int flush_journal_list(struct super_block *s, | |||
1616 | if (err) | 1616 | if (err) |
1617 | reiserfs_abort(s, -EIO, | 1617 | reiserfs_abort(s, -EIO, |
1618 | "Write error while updating journal header in %s", | 1618 | "Write error while updating journal header in %s", |
1619 | __FUNCTION__); | 1619 | __func__); |
1620 | } | 1620 | } |
1621 | remove_all_from_journal_list(s, jl, 0); | 1621 | remove_all_from_journal_list(s, jl, 0); |
1622 | list_del_init(&jl->j_list); | 1622 | list_del_init(&jl->j_list); |
@@ -4316,5 +4316,5 @@ static void __reiserfs_journal_abort_soft(struct super_block *sb, int errno) | |||
4316 | 4316 | ||
4317 | void reiserfs_journal_abort(struct super_block *sb, int errno) | 4317 | void reiserfs_journal_abort(struct super_block *sb, int errno) |
4318 | { | 4318 | { |
4319 | return __reiserfs_journal_abort_soft(sb, errno); | 4319 | __reiserfs_journal_abort_soft(sb, errno); |
4320 | } | 4320 | } |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 8867533cb727..c1add28dd45e 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -301,7 +301,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen, | |||
301 | path_to_entry, de); | 301 | path_to_entry, de); |
302 | if (retval == IO_ERROR) { | 302 | if (retval == IO_ERROR) { |
303 | reiserfs_warning(dir->i_sb, "zam-7001: io error in %s", | 303 | reiserfs_warning(dir->i_sb, "zam-7001: io error in %s", |
304 | __FUNCTION__); | 304 | __func__); |
305 | return IO_ERROR; | 305 | return IO_ERROR; |
306 | } | 306 | } |
307 | 307 | ||
@@ -496,7 +496,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, | |||
496 | reiserfs_warning(dir->i_sb, | 496 | reiserfs_warning(dir->i_sb, |
497 | "zam-7002:%s: \"reiserfs_find_entry\" " | 497 | "zam-7002:%s: \"reiserfs_find_entry\" " |
498 | "has returned unexpected value (%d)", | 498 | "has returned unexpected value (%d)", |
499 | __FUNCTION__, retval); | 499 | __func__, retval); |
500 | } | 500 | } |
501 | 501 | ||
502 | return -EEXIST; | 502 | return -EEXIST; |
@@ -907,7 +907,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
907 | 907 | ||
908 | if (inode->i_nlink != 2 && inode->i_nlink != 1) | 908 | if (inode->i_nlink != 2 && inode->i_nlink != 1) |
909 | reiserfs_warning(inode->i_sb, "%s: empty directory has nlink " | 909 | reiserfs_warning(inode->i_sb, "%s: empty directory has nlink " |
910 | "!= 2 (%d)", __FUNCTION__, inode->i_nlink); | 910 | "!= 2 (%d)", __func__, inode->i_nlink); |
911 | 911 | ||
912 | clear_nlink(inode); | 912 | clear_nlink(inode); |
913 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; | 913 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; |
@@ -984,7 +984,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
984 | 984 | ||
985 | if (!inode->i_nlink) { | 985 | if (!inode->i_nlink) { |
986 | reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file " | 986 | reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file " |
987 | "(%s:%lu), %d", __FUNCTION__, | 987 | "(%s:%lu), %d", __func__, |
988 | reiserfs_bdevname(inode->i_sb), inode->i_ino, | 988 | reiserfs_bdevname(inode->i_sb), inode->i_ino, |
989 | inode->i_nlink); | 989 | inode->i_nlink); |
990 | inode->i_nlink = 1; | 990 | inode->i_nlink = 1; |
diff --git a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c index 65feba4deb69..ea0cf8c28a99 100644 --- a/fs/reiserfs/objectid.c +++ b/fs/reiserfs/objectid.c | |||
@@ -61,7 +61,7 @@ __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th) | |||
61 | /* comment needed -Hans */ | 61 | /* comment needed -Hans */ |
62 | unused_objectid = le32_to_cpu(map[1]); | 62 | unused_objectid = le32_to_cpu(map[1]); |
63 | if (unused_objectid == U32_MAX) { | 63 | if (unused_objectid == U32_MAX) { |
64 | reiserfs_warning(s, "%s: no more object ids", __FUNCTION__); | 64 | reiserfs_warning(s, "%s: no more object ids", __func__); |
65 | reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s)); | 65 | reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s)); |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
@@ -114,7 +114,7 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, | |||
114 | if (objectid_to_release == le32_to_cpu(map[i])) { | 114 | if (objectid_to_release == le32_to_cpu(map[i])) { |
115 | /* This incrementation unallocates the objectid. */ | 115 | /* This incrementation unallocates the objectid. */ |
116 | //map[i]++; | 116 | //map[i]++; |
117 | map[i] = cpu_to_le32(le32_to_cpu(map[i]) + 1); | 117 | le32_add_cpu(&map[i], 1); |
118 | 118 | ||
119 | /* Did we unallocate the last member of an odd sequence, and can shrink oids? */ | 119 | /* Did we unallocate the last member of an odd sequence, and can shrink oids? */ |
120 | if (map[i] == map[i + 1]) { | 120 | if (map[i] == map[i + 1]) { |
@@ -138,8 +138,7 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, | |||
138 | /* size of objectid map is not changed */ | 138 | /* size of objectid map is not changed */ |
139 | if (objectid_to_release + 1 == le32_to_cpu(map[i + 1])) { | 139 | if (objectid_to_release + 1 == le32_to_cpu(map[i + 1])) { |
140 | //objectid_map[i+1]--; | 140 | //objectid_map[i+1]--; |
141 | map[i + 1] = | 141 | le32_add_cpu(&map[i + 1], -1); |
142 | cpu_to_le32(le32_to_cpu(map[i + 1]) - 1); | ||
143 | return; | 142 | return; |
144 | } | 143 | } |
145 | 144 | ||
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index d2db2417b2bd..abbc64dcc8d4 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -1419,8 +1419,7 @@ int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | |||
1419 | 1419 | ||
1420 | inode_generation = | 1420 | inode_generation = |
1421 | &REISERFS_SB(th->t_super)->s_rs->s_inode_generation; | 1421 | &REISERFS_SB(th->t_super)->s_rs->s_inode_generation; |
1422 | *inode_generation = | 1422 | le32_add_cpu(inode_generation, 1); |
1423 | cpu_to_le32(le32_to_cpu(*inode_generation) + 1); | ||
1424 | } | 1423 | } |
1425 | /* USE_INODE_GENERATION_COUNTER */ | 1424 | /* USE_INODE_GENERATION_COUNTER */ |
1426 | #endif | 1425 | #endif |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 393cc22c1717..ed424d708e69 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -304,7 +304,7 @@ static int finish_unfinished(struct super_block *s) | |||
304 | /* Turn quotas off */ | 304 | /* Turn quotas off */ |
305 | for (i = 0; i < MAXQUOTAS; i++) { | 305 | for (i = 0; i < MAXQUOTAS; i++) { |
306 | if (sb_dqopt(s)->files[i]) | 306 | if (sb_dqopt(s)->files[i]) |
307 | vfs_quota_off_mount(s, i); | 307 | vfs_quota_off(s, i, 0); |
308 | } | 308 | } |
309 | if (ms_active_set) | 309 | if (ms_active_set) |
310 | /* Restore the flag back */ | 310 | /* Restore the flag back */ |
@@ -634,7 +634,7 @@ static int reiserfs_acquire_dquot(struct dquot *); | |||
634 | static int reiserfs_release_dquot(struct dquot *); | 634 | static int reiserfs_release_dquot(struct dquot *); |
635 | static int reiserfs_mark_dquot_dirty(struct dquot *); | 635 | static int reiserfs_mark_dquot_dirty(struct dquot *); |
636 | static int reiserfs_write_info(struct super_block *, int); | 636 | static int reiserfs_write_info(struct super_block *, int); |
637 | static int reiserfs_quota_on(struct super_block *, int, int, char *); | 637 | static int reiserfs_quota_on(struct super_block *, int, int, char *, int); |
638 | 638 | ||
639 | static struct dquot_operations reiserfs_quota_operations = { | 639 | static struct dquot_operations reiserfs_quota_operations = { |
640 | .initialize = reiserfs_dquot_initialize, | 640 | .initialize = reiserfs_dquot_initialize, |
@@ -1890,8 +1890,14 @@ static int reiserfs_dquot_drop(struct inode *inode) | |||
1890 | ret = | 1890 | ret = |
1891 | journal_begin(&th, inode->i_sb, | 1891 | journal_begin(&th, inode->i_sb, |
1892 | 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb)); | 1892 | 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb)); |
1893 | if (ret) | 1893 | if (ret) { |
1894 | /* | ||
1895 | * We call dquot_drop() anyway to at least release references | ||
1896 | * to quota structures so that umount does not hang. | ||
1897 | */ | ||
1898 | dquot_drop(inode); | ||
1894 | goto out; | 1899 | goto out; |
1900 | } | ||
1895 | ret = dquot_drop(inode); | 1901 | ret = dquot_drop(inode); |
1896 | err = | 1902 | err = |
1897 | journal_end(&th, inode->i_sb, | 1903 | journal_end(&th, inode->i_sb, |
@@ -2015,13 +2021,17 @@ static int reiserfs_quota_on_mount(struct super_block *sb, int type) | |||
2015 | * Standard function to be called on quota_on | 2021 | * Standard function to be called on quota_on |
2016 | */ | 2022 | */ |
2017 | static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | 2023 | static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, |
2018 | char *path) | 2024 | char *path, int remount) |
2019 | { | 2025 | { |
2020 | int err; | 2026 | int err; |
2021 | struct nameidata nd; | 2027 | struct nameidata nd; |
2028 | struct inode *inode; | ||
2022 | 2029 | ||
2023 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) | 2030 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) |
2024 | return -EINVAL; | 2031 | return -EINVAL; |
2032 | /* No more checks needed? Path and format_id are bogus anyway... */ | ||
2033 | if (remount) | ||
2034 | return vfs_quota_on(sb, type, format_id, path, 1); | ||
2025 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); | 2035 | err = path_lookup(path, LOOKUP_FOLLOW, &nd); |
2026 | if (err) | 2036 | if (err) |
2027 | return err; | 2037 | return err; |
@@ -2030,18 +2040,24 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2030 | path_put(&nd.path); | 2040 | path_put(&nd.path); |
2031 | return -EXDEV; | 2041 | return -EXDEV; |
2032 | } | 2042 | } |
2043 | inode = nd.path.dentry->d_inode; | ||
2033 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ | 2044 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ |
2034 | if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) { | 2045 | if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) { |
2035 | reiserfs_warning(sb, | 2046 | err = reiserfs_unpack(inode, NULL); |
2036 | "reiserfs: Quota file must have tail packing disabled."); | 2047 | if (err) { |
2037 | path_put(&nd.path); | 2048 | reiserfs_warning(sb, |
2038 | return -EINVAL; | 2049 | "reiserfs: Unpacking tail of quota file failed" |
2050 | " (%d). Cannot turn on quotas.", err); | ||
2051 | path_put(&nd.path); | ||
2052 | return -EINVAL; | ||
2053 | } | ||
2054 | mark_inode_dirty(inode); | ||
2039 | } | 2055 | } |
2040 | /* Not journalling quota? No more tests needed... */ | 2056 | /* Not journalling quota? No more tests needed... */ |
2041 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && | 2057 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && |
2042 | !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { | 2058 | !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { |
2043 | path_put(&nd.path); | 2059 | path_put(&nd.path); |
2044 | return vfs_quota_on(sb, type, format_id, path); | 2060 | return vfs_quota_on(sb, type, format_id, path, 0); |
2045 | } | 2061 | } |
2046 | /* Quotafile not of fs root? */ | 2062 | /* Quotafile not of fs root? */ |
2047 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) | 2063 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) |
@@ -2049,7 +2065,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2049 | "reiserfs: Quota file not on filesystem root. " | 2065 | "reiserfs: Quota file not on filesystem root. " |
2050 | "Journalled quota will not work."); | 2066 | "Journalled quota will not work."); |
2051 | path_put(&nd.path); | 2067 | path_put(&nd.path); |
2052 | return vfs_quota_on(sb, type, format_id, path); | 2068 | return vfs_quota_on(sb, type, format_id, path, 0); |
2053 | } | 2069 | } |
2054 | 2070 | ||
2055 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | 2071 | /* Read data from quotafile - avoid pagecache and such because we cannot afford |
diff --git a/fs/super.c b/fs/super.c index 4798350b2bc9..a5a4aca7e22f 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -179,7 +179,7 @@ void deactivate_super(struct super_block *s) | |||
179 | if (atomic_dec_and_lock(&s->s_active, &sb_lock)) { | 179 | if (atomic_dec_and_lock(&s->s_active, &sb_lock)) { |
180 | s->s_count -= S_BIAS-1; | 180 | s->s_count -= S_BIAS-1; |
181 | spin_unlock(&sb_lock); | 181 | spin_unlock(&sb_lock); |
182 | DQUOT_OFF(s); | 182 | DQUOT_OFF(s, 0); |
183 | down_write(&s->s_umount); | 183 | down_write(&s->s_umount); |
184 | fs->kill_sb(s); | 184 | fs->kill_sb(s); |
185 | put_filesystem(fs); | 185 | put_filesystem(fs); |
@@ -608,6 +608,7 @@ retry: | |||
608 | int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | 608 | int do_remount_sb(struct super_block *sb, int flags, void *data, int force) |
609 | { | 609 | { |
610 | int retval; | 610 | int retval; |
611 | int remount_rw; | ||
611 | 612 | ||
612 | #ifdef CONFIG_BLOCK | 613 | #ifdef CONFIG_BLOCK |
613 | if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) | 614 | if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) |
@@ -625,8 +626,11 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
625 | mark_files_ro(sb); | 626 | mark_files_ro(sb); |
626 | else if (!fs_may_remount_ro(sb)) | 627 | else if (!fs_may_remount_ro(sb)) |
627 | return -EBUSY; | 628 | return -EBUSY; |
628 | DQUOT_OFF(sb); | 629 | retval = DQUOT_OFF(sb, 1); |
630 | if (retval < 0 && retval != -ENOSYS) | ||
631 | return -EBUSY; | ||
629 | } | 632 | } |
633 | remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY); | ||
630 | 634 | ||
631 | if (sb->s_op->remount_fs) { | 635 | if (sb->s_op->remount_fs) { |
632 | lock_super(sb); | 636 | lock_super(sb); |
@@ -636,6 +640,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
636 | return retval; | 640 | return retval; |
637 | } | 641 | } |
638 | sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); | 642 | sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); |
643 | if (remount_rw) | ||
644 | DQUOT_ON_REMOUNT(sb); | ||
639 | return 0; | 645 | return 0; |
640 | } | 646 | } |
641 | 647 | ||
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index ba5537d4bc15..2b34c8ca6c83 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -890,7 +890,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
890 | 890 | ||
891 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { | 891 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { |
892 | kernel_lb_addr eloc; | 892 | kernel_lb_addr eloc; |
893 | uint32_t elen; | 893 | uint32_t bsize; |
894 | 894 | ||
895 | block = udf_new_block(inode->i_sb, inode, | 895 | block = udf_new_block(inode->i_sb, inode, |
896 | iinfo->i_location.partitionReferenceNum, | 896 | iinfo->i_location.partitionReferenceNum, |
@@ -903,9 +903,9 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
903 | eloc.logicalBlockNum = block; | 903 | eloc.logicalBlockNum = block; |
904 | eloc.partitionReferenceNum = | 904 | eloc.partitionReferenceNum = |
905 | iinfo->i_location.partitionReferenceNum; | 905 | iinfo->i_location.partitionReferenceNum; |
906 | elen = inode->i_sb->s_blocksize; | 906 | bsize = inode->i_sb->s_blocksize; |
907 | iinfo->i_lenExtents = elen; | 907 | iinfo->i_lenExtents = bsize; |
908 | udf_add_aext(inode, &epos, eloc, elen, 0); | 908 | udf_add_aext(inode, &epos, eloc, bsize, 0); |
909 | brelse(epos.bh); | 909 | brelse(epos.bh); |
910 | 910 | ||
911 | block = udf_get_pblock(inode->i_sb, block, | 911 | block = udf_get_pblock(inode->i_sb, block, |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 1e7598fb9787..0d9ada173739 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -277,7 +277,7 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg, | |||
277 | if (!page)/* it was truncated */ | 277 | if (!page)/* it was truncated */ |
278 | continue; | 278 | continue; |
279 | if (IS_ERR(page)) {/* or EIO */ | 279 | if (IS_ERR(page)) {/* or EIO */ |
280 | ufs_error(inode->i_sb, __FUNCTION__, | 280 | ufs_error(inode->i_sb, __func__, |
281 | "read of page %llu failed\n", | 281 | "read of page %llu failed\n", |
282 | (unsigned long long)index); | 282 | (unsigned long long)index); |
283 | continue; | 283 | continue; |
@@ -308,7 +308,7 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg, | |||
308 | ll_rw_block(READ, 1, &bh); | 308 | ll_rw_block(READ, 1, &bh); |
309 | wait_on_buffer(bh); | 309 | wait_on_buffer(bh); |
310 | if (!buffer_uptodate(bh)) { | 310 | if (!buffer_uptodate(bh)) { |
311 | ufs_error(inode->i_sb, __FUNCTION__, | 311 | ufs_error(inode->i_sb, __func__, |
312 | "read of block failed\n"); | 312 | "read of block failed\n"); |
313 | break; | 313 | break; |
314 | } | 314 | } |
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index ef563fc8d72c..df0bef18742d 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
@@ -179,7 +179,7 @@ bad_entry: | |||
179 | goto fail; | 179 | goto fail; |
180 | Eend: | 180 | Eend: |
181 | p = (struct ufs_dir_entry *)(kaddr + offs); | 181 | p = (struct ufs_dir_entry *)(kaddr + offs); |
182 | ufs_error(sb, __FUNCTION__, | 182 | ufs_error(sb, __func__, |
183 | "entry in directory #%lu spans the page boundary" | 183 | "entry in directory #%lu spans the page boundary" |
184 | "offset=%lu", | 184 | "offset=%lu", |
185 | dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs); | 185 | dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs); |
@@ -284,7 +284,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry, | |||
284 | kaddr += ufs_last_byte(dir, n) - reclen; | 284 | kaddr += ufs_last_byte(dir, n) - reclen; |
285 | while ((char *) de <= kaddr) { | 285 | while ((char *) de <= kaddr) { |
286 | if (de->d_reclen == 0) { | 286 | if (de->d_reclen == 0) { |
287 | ufs_error(dir->i_sb, __FUNCTION__, | 287 | ufs_error(dir->i_sb, __func__, |
288 | "zero-length directory entry"); | 288 | "zero-length directory entry"); |
289 | ufs_put_page(page); | 289 | ufs_put_page(page); |
290 | goto out; | 290 | goto out; |
@@ -356,7 +356,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) | |||
356 | goto got_it; | 356 | goto got_it; |
357 | } | 357 | } |
358 | if (de->d_reclen == 0) { | 358 | if (de->d_reclen == 0) { |
359 | ufs_error(dir->i_sb, __FUNCTION__, | 359 | ufs_error(dir->i_sb, __func__, |
360 | "zero-length directory entry"); | 360 | "zero-length directory entry"); |
361 | err = -EIO; | 361 | err = -EIO; |
362 | goto out_unlock; | 362 | goto out_unlock; |
@@ -456,7 +456,7 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
456 | struct page *page = ufs_get_page(inode, n); | 456 | struct page *page = ufs_get_page(inode, n); |
457 | 457 | ||
458 | if (IS_ERR(page)) { | 458 | if (IS_ERR(page)) { |
459 | ufs_error(sb, __FUNCTION__, | 459 | ufs_error(sb, __func__, |
460 | "bad page in #%lu", | 460 | "bad page in #%lu", |
461 | inode->i_ino); | 461 | inode->i_ino); |
462 | filp->f_pos += PAGE_CACHE_SIZE - offset; | 462 | filp->f_pos += PAGE_CACHE_SIZE - offset; |
@@ -475,7 +475,7 @@ ufs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
475 | limit = kaddr + ufs_last_byte(inode, n) - UFS_DIR_REC_LEN(1); | 475 | limit = kaddr + ufs_last_byte(inode, n) - UFS_DIR_REC_LEN(1); |
476 | for ( ;(char*)de <= limit; de = ufs_next_entry(sb, de)) { | 476 | for ( ;(char*)de <= limit; de = ufs_next_entry(sb, de)) { |
477 | if (de->d_reclen == 0) { | 477 | if (de->d_reclen == 0) { |
478 | ufs_error(sb, __FUNCTION__, | 478 | ufs_error(sb, __func__, |
479 | "zero-length directory entry"); | 479 | "zero-length directory entry"); |
480 | ufs_put_page(page); | 480 | ufs_put_page(page); |
481 | return -EIO; | 481 | return -EIO; |
@@ -536,7 +536,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir, | |||
536 | 536 | ||
537 | while ((char*)de < (char*)dir) { | 537 | while ((char*)de < (char*)dir) { |
538 | if (de->d_reclen == 0) { | 538 | if (de->d_reclen == 0) { |
539 | ufs_error(inode->i_sb, __FUNCTION__, | 539 | ufs_error(inode->i_sb, __func__, |
540 | "zero-length directory entry"); | 540 | "zero-length directory entry"); |
541 | err = -EIO; | 541 | err = -EIO; |
542 | goto out; | 542 | goto out; |
@@ -633,7 +633,7 @@ int ufs_empty_dir(struct inode * inode) | |||
633 | 633 | ||
634 | while ((char *)de <= kaddr) { | 634 | while ((char *)de <= kaddr) { |
635 | if (de->d_reclen == 0) { | 635 | if (de->d_reclen == 0) { |
636 | ufs_error(inode->i_sb, __FUNCTION__, | 636 | ufs_error(inode->i_sb, __func__, |
637 | "zero-length directory entry: " | 637 | "zero-length directory entry: " |
638 | "kaddr=%p, de=%p\n", kaddr, de); | 638 | "kaddr=%p, de=%p\n", kaddr, de); |
639 | goto not_empty; | 639 | goto not_empty; |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 5446b888fc8e..39f877898565 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -929,7 +929,7 @@ void ufs_delete_inode (struct inode * inode) | |||
929 | old_i_size = inode->i_size; | 929 | old_i_size = inode->i_size; |
930 | inode->i_size = 0; | 930 | inode->i_size = 0; |
931 | if (inode->i_blocks && ufs_truncate(inode, old_i_size)) | 931 | if (inode->i_blocks && ufs_truncate(inode, old_i_size)) |
932 | ufs_warning(inode->i_sb, __FUNCTION__, "ufs_truncate failed\n"); | 932 | ufs_warning(inode->i_sb, __func__, "ufs_truncate failed\n"); |
933 | ufs_free_inode (inode); | 933 | ufs_free_inode (inode); |
934 | unlock_kernel(); | 934 | unlock_kernel(); |
935 | return; | 935 | return; |
diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h index 1683d2bee614..8d974c4fd18b 100644 --- a/fs/ufs/swab.h +++ b/fs/ufs/swab.h | |||
@@ -40,25 +40,7 @@ cpu_to_fs64(struct super_block *sbp, u64 n) | |||
40 | return (__force __fs64)cpu_to_be64(n); | 40 | return (__force __fs64)cpu_to_be64(n); |
41 | } | 41 | } |
42 | 42 | ||
43 | static __inline u32 | 43 | static inline u32 |
44 | fs64_add(struct super_block *sbp, u32 *n, int d) | ||
45 | { | ||
46 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | ||
47 | return *n = cpu_to_le64(le64_to_cpu(*n)+d); | ||
48 | else | ||
49 | return *n = cpu_to_be64(be64_to_cpu(*n)+d); | ||
50 | } | ||
51 | |||
52 | static __inline u32 | ||
53 | fs64_sub(struct super_block *sbp, u32 *n, int d) | ||
54 | { | ||
55 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | ||
56 | return *n = cpu_to_le64(le64_to_cpu(*n)-d); | ||
57 | else | ||
58 | return *n = cpu_to_be64(be64_to_cpu(*n)-d); | ||
59 | } | ||
60 | |||
61 | static __inline u32 | ||
62 | fs32_to_cpu(struct super_block *sbp, __fs32 n) | 44 | fs32_to_cpu(struct super_block *sbp, __fs32 n) |
63 | { | 45 | { |
64 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 46 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
@@ -80,18 +62,18 @@ static inline void | |||
80 | fs32_add(struct super_block *sbp, __fs32 *n, int d) | 62 | fs32_add(struct super_block *sbp, __fs32 *n, int d) |
81 | { | 63 | { |
82 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 64 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
83 | *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)+d); | 65 | le32_add_cpu((__le32 *)n, d); |
84 | else | 66 | else |
85 | *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)+d); | 67 | be32_add_cpu((__be32 *)n, d); |
86 | } | 68 | } |
87 | 69 | ||
88 | static inline void | 70 | static inline void |
89 | fs32_sub(struct super_block *sbp, __fs32 *n, int d) | 71 | fs32_sub(struct super_block *sbp, __fs32 *n, int d) |
90 | { | 72 | { |
91 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 73 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
92 | *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)-d); | 74 | le32_add_cpu((__le32 *)n, -d); |
93 | else | 75 | else |
94 | *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)-d); | 76 | be32_add_cpu((__be32 *)n, -d); |
95 | } | 77 | } |
96 | 78 | ||
97 | static inline u16 | 79 | static inline u16 |
@@ -116,18 +98,18 @@ static inline void | |||
116 | fs16_add(struct super_block *sbp, __fs16 *n, int d) | 98 | fs16_add(struct super_block *sbp, __fs16 *n, int d) |
117 | { | 99 | { |
118 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 100 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
119 | *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)+d); | 101 | le16_add_cpu((__le16 *)n, d); |
120 | else | 102 | else |
121 | *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)+d); | 103 | be16_add_cpu((__be16 *)n, d); |
122 | } | 104 | } |
123 | 105 | ||
124 | static inline void | 106 | static inline void |
125 | fs16_sub(struct super_block *sbp, __fs16 *n, int d) | 107 | fs16_sub(struct super_block *sbp, __fs16 *n, int d) |
126 | { | 108 | { |
127 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) | 109 | if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE) |
128 | *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)-d); | 110 | le16_add_cpu((__le16 *)n, -d); |
129 | else | 111 | else |
130 | *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)-d); | 112 | be16_add_cpu((__be16 *)n, -d); |
131 | } | 113 | } |
132 | 114 | ||
133 | #endif /* _UFS_SWAB_H */ | 115 | #endif /* _UFS_SWAB_H */ |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index fcb9231bb9ed..244a1aaa940e 100644 --- a/fs/ufs/ufs.h +++ b/fs/ufs/ufs.h | |||
@@ -66,7 +66,7 @@ struct ufs_inode_info { | |||
66 | #ifdef CONFIG_UFS_DEBUG | 66 | #ifdef CONFIG_UFS_DEBUG |
67 | # define UFSD(f, a...) { \ | 67 | # define UFSD(f, a...) { \ |
68 | printk ("UFSD (%s, %d): %s:", \ | 68 | printk ("UFSD (%s, %d): %s:", \ |
69 | __FILE__, __LINE__, __FUNCTION__); \ | 69 | __FILE__, __LINE__, __func__); \ |
70 | printk (f, ## a); \ | 70 | printk (f, ## a); \ |
71 | } | 71 | } |
72 | #else | 72 | #else |
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index cd450bea9f1a..5b66162d0747 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c | |||
@@ -176,15 +176,10 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len) | |||
176 | for (i = 0; i < len; i++) | 176 | for (i = 0; i < len; i++) |
177 | if (vfat_bad_char(s[i])) | 177 | if (vfat_bad_char(s[i])) |
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | return 0; | ||
180 | } | ||
181 | 179 | ||
182 | static int vfat_valid_longname(const unsigned char *name, unsigned int len) | 180 | if (s[i - 1] == ' ') /* last character cannot be space */ |
183 | { | ||
184 | if (name[len - 1] == ' ') | ||
185 | return -EINVAL; | 181 | return -EINVAL; |
186 | if (len >= 256) | 182 | |
187 | return -ENAMETOOLONG; | ||
188 | return 0; | 183 | return 0; |
189 | } | 184 | } |
190 | 185 | ||
@@ -477,7 +472,7 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, | |||
477 | if (utf8) { | 472 | if (utf8) { |
478 | int name_len = strlen(name); | 473 | int name_len = strlen(name); |
479 | 474 | ||
480 | *outlen = utf8_mbstowcs((wchar_t *)outname, name, PAGE_SIZE); | 475 | *outlen = utf8_mbstowcs((wchar_t *)outname, name, PATH_MAX); |
481 | 476 | ||
482 | /* | 477 | /* |
483 | * We stripped '.'s before and set len appropriately, | 478 | * We stripped '.'s before and set len appropriately, |
@@ -485,11 +480,14 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, | |||
485 | */ | 480 | */ |
486 | *outlen -= (name_len - len); | 481 | *outlen -= (name_len - len); |
487 | 482 | ||
483 | if (*outlen > 255) | ||
484 | return -ENAMETOOLONG; | ||
485 | |||
488 | op = &outname[*outlen * sizeof(wchar_t)]; | 486 | op = &outname[*outlen * sizeof(wchar_t)]; |
489 | } else { | 487 | } else { |
490 | if (nls) { | 488 | if (nls) { |
491 | for (i = 0, ip = name, op = outname, *outlen = 0; | 489 | for (i = 0, ip = name, op = outname, *outlen = 0; |
492 | i < len && *outlen <= 260; | 490 | i < len && *outlen <= 255; |
493 | *outlen += 1) | 491 | *outlen += 1) |
494 | { | 492 | { |
495 | if (escape && (*ip == ':')) { | 493 | if (escape && (*ip == ':')) { |
@@ -525,18 +523,20 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, | |||
525 | op += 2; | 523 | op += 2; |
526 | } | 524 | } |
527 | } | 525 | } |
526 | if (i < len) | ||
527 | return -ENAMETOOLONG; | ||
528 | } else { | 528 | } else { |
529 | for (i = 0, ip = name, op = outname, *outlen = 0; | 529 | for (i = 0, ip = name, op = outname, *outlen = 0; |
530 | i < len && *outlen <= 260; | 530 | i < len && *outlen <= 255; |
531 | i++, *outlen += 1) | 531 | i++, *outlen += 1) |
532 | { | 532 | { |
533 | *op++ = *ip++; | 533 | *op++ = *ip++; |
534 | *op++ = 0; | 534 | *op++ = 0; |
535 | } | 535 | } |
536 | if (i < len) | ||
537 | return -ENAMETOOLONG; | ||
536 | } | 538 | } |
537 | } | 539 | } |
538 | if (*outlen > 260) | ||
539 | return -ENAMETOOLONG; | ||
540 | 540 | ||
541 | *longlen = *outlen; | 541 | *longlen = *outlen; |
542 | if (*outlen % 13) { | 542 | if (*outlen % 13) { |
@@ -565,7 +565,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, | |||
565 | struct fat_mount_options *opts = &sbi->options; | 565 | struct fat_mount_options *opts = &sbi->options; |
566 | struct msdos_dir_slot *ps; | 566 | struct msdos_dir_slot *ps; |
567 | struct msdos_dir_entry *de; | 567 | struct msdos_dir_entry *de; |
568 | unsigned long page; | ||
569 | unsigned char cksum, lcase; | 568 | unsigned char cksum, lcase; |
570 | unsigned char msdos_name[MSDOS_NAME]; | 569 | unsigned char msdos_name[MSDOS_NAME]; |
571 | wchar_t *uname; | 570 | wchar_t *uname; |
@@ -574,15 +573,11 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, | |||
574 | loff_t offset; | 573 | loff_t offset; |
575 | 574 | ||
576 | *nr_slots = 0; | 575 | *nr_slots = 0; |
577 | err = vfat_valid_longname(name, len); | ||
578 | if (err) | ||
579 | return err; | ||
580 | 576 | ||
581 | page = __get_free_page(GFP_KERNEL); | 577 | uname = __getname(); |
582 | if (!page) | 578 | if (!uname) |
583 | return -ENOMEM; | 579 | return -ENOMEM; |
584 | 580 | ||
585 | uname = (wchar_t *)page; | ||
586 | err = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize, | 581 | err = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize, |
587 | opts->unicode_xlate, opts->utf8, sbi->nls_io); | 582 | opts->unicode_xlate, opts->utf8, sbi->nls_io); |
588 | if (err) | 583 | if (err) |
@@ -634,7 +629,7 @@ shortname: | |||
634 | de->starthi = cpu_to_le16(cluster >> 16); | 629 | de->starthi = cpu_to_le16(cluster >> 16); |
635 | de->size = 0; | 630 | de->size = 0; |
636 | out_free: | 631 | out_free: |
637 | free_page(page); | 632 | __putname(uname); |
638 | return err; | 633 | return err; |
639 | } | 634 | } |
640 | 635 | ||
@@ -1003,7 +998,7 @@ static const struct inode_operations vfat_dir_inode_operations = { | |||
1003 | .mkdir = vfat_mkdir, | 998 | .mkdir = vfat_mkdir, |
1004 | .rmdir = vfat_rmdir, | 999 | .rmdir = vfat_rmdir, |
1005 | .rename = vfat_rename, | 1000 | .rename = vfat_rename, |
1006 | .setattr = fat_notify_change, | 1001 | .setattr = fat_setattr, |
1007 | .getattr = fat_getattr, | 1002 | .getattr = fat_getattr, |
1008 | }; | 1003 | }; |
1009 | 1004 | ||