lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141107215401.883.74477.stgit@birch.djwong.org>
Date:	Fri, 07 Nov 2014 13:54:01 -0800
From:	"Darrick J. Wong" <darrick.wong@...cle.com>
To:	tytso@....edu, darrick.wong@...cle.com
Cc:	linux-ext4@...r.kernel.org
Subject: [PATCH 30/47] resize2fs: don't play stupid games with the block
 count

While it may be true that playing games with old_fs' block count
during a grow operation shuts up a bunch of warnings, resize2fs
doesn't actually expand the group descriptor array to match the size
we're artificially stuffing into old_fs, which means that if we
actually need to allocate a block out of the larger fs (i.e. we're in
desperation mode), ext2fs_block_alloc_stats2() scribbles on the heap,
leading to crashes if you're lucky and FS corruption if not.

So, rip that piece out and turn off com_err warnings properly and add
a test case to deal with growing a nearly full filesystem.

Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
 resize/resize2fs.c         |   19 +-
 tests/r_expand_full/expect |  375 ++++++++++++++++++++++++++++++++++++++++++++
 tests/r_expand_full/name   |    1 
 tests/r_expand_full/script |   79 +++++++++
 4 files changed, 462 insertions(+), 12 deletions(-)
 create mode 100644 tests/r_expand_full/expect
 create mode 100644 tests/r_expand_full/name
 create mode 100644 tests/r_expand_full/script


diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index a760593..0d1f7fa 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1629,6 +1629,11 @@ out:
 	return errcode;
 }
 
+static void quiet_com_err_proc(const char *whoami, errcode_t code,
+			       const char *fmt, va_list args)
+{
+}
+
 static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
 {
 	struct process_block_struct	pb;
@@ -1638,7 +1643,6 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
 	errcode_t		retval;
 	char			*block_buf = 0;
 	ext2_ino_t		start_to_move;
-	blk64_t			orig_size;
 	int			inode_size;
 
 	if ((rfs->old_fs->group_desc_count <=
@@ -1646,16 +1650,7 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
 	    !rfs->bmap)
 		return 0;
 
-	/*
-	 * Save the original size of the old filesystem, and
-	 * temporarily set the size to be the new size if the new size
-	 * is larger.  We need to do this to avoid catching an error
-	 * by the block iterator routines
-	 */
-	orig_size = ext2fs_blocks_count(rfs->old_fs->super);
-	if (orig_size < ext2fs_blocks_count(rfs->new_fs->super))
-		ext2fs_blocks_count_set(rfs->old_fs->super,
-				ext2fs_blocks_count(rfs->new_fs->super));
+	set_com_err_hook(quiet_com_err_proc);
 
 	retval = ext2fs_open_inode_scan(rfs->old_fs, 0, &scan);
 	if (retval) goto errout;
@@ -1791,7 +1786,7 @@ remap_blocks:
 	io_channel_flush(rfs->old_fs->io);
 
 errout:
-	ext2fs_blocks_count_set(rfs->old_fs->super, orig_size);
+	reset_com_err_hook();
 	if (rfs->bmap) {
 		ext2fs_free_extent_table(rfs->bmap);
 		rfs->bmap = 0;
diff --git a/tests/r_expand_full/expect b/tests/r_expand_full/expect
new file mode 100644
index 0000000..c80baa2
--- /dev/null
+++ b/tests/r_expand_full/expect
@@ -0,0 +1,375 @@
+resize2fs test
+Creating filesystem with 786432 1k blocks and 98304 inodes
+Superblock backups stored on blocks: 
+	8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553
+
+Allocating group tables:      .....done                            
+Writing inode tables:      .....done                            
+Creating journal (16384 blocks): done
+Creating 727 huge file(s) with 1024 blocks each: done
+Writing superblocks and filesystem accounting information:      .....done
+
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+Exit status is 0
+resize2fs test.img
+Resizing the filesystem on test.img to 3145728 (1k) blocks.
+The filesystem on test.img is now 3145728 (1k) blocks long.
+
+Exit status is 0
+Change in FS metadata:
+@@ -1,15 +1,15 @@
+ 
+ group:block:super:gdt:bbitmap:ibitmap:itable
+-0:1:1:2-4:5:6:7
+-1:8193:8193:8194-8196:8197:8198:8199
++0:1:1:2-13:263:264:265
++1:8193:8193:8194-8205:8455:8456:8457
+ 2:16385:-1:-1:16385:16386:16387
+-3:24577:24577:24578-24580:24581:24582:24583
++3:24577:24577:24578-24589:24839:24840:24841
+ 4:32769:-1:-1:32769:32770:32771
+-5:40961:40961:40962-40964:40965:40966:40967
++5:40961:40961:40962-40973:41223:41224:41225
+ 6:49153:-1:-1:49153:49154:49155
+-7:57345:57345:57346-57348:57349:57350:57351
++7:57345:57345:57346-57357:57607:57608:57609
+ 8:65537:-1:-1:65537:65538:65539
+-9:73729:73729:73730-73732:73733:73734:73735
++9:73729:73729:73730-73741:73991:73992:73993
+ 10:81921:-1:-1:81921:81922:81923
+ 11:90113:-1:-1:90113:90114:90115
+ 12:98305:-1:-1:98305:98306:98307
+@@ -25,9 +25,9 @@
+ 22:180225:-1:-1:180225:180226:180227
+ 23:188417:-1:-1:188417:188418:188419
+ 24:196609:-1:-1:196609:196610:196611
+-25:204801:204801:204802-204804:204805:204806:204807
++25:204801:204801:204802-204813:205063:205064:205065
+ 26:212993:-1:-1:212993:212994:212995
+-27:221185:221185:221186-221188:221189:221190:221191
++27:221185:221185:221186-221197:221447:221448:221449
+ 28:229377:-1:-1:229377:229378:229379
+ 29:237569:-1:-1:237569:237570:237571
+ 30:245761:-1:-1:245761:245762:245763
+@@ -49,7 +49,7 @@
+ 46:376833:-1:-1:376833:376834:376835
+ 47:385025:-1:-1:385025:385026:385027
+ 48:393217:-1:-1:393217:393218:393219
+-49:401409:401409:401410-401412:401413:401414:401415
++49:401409:401409:401410-401421:401671:401672:401673
+ 50:409601:-1:-1:409601:409602:409603
+ 51:417793:-1:-1:417793:417794:417795
+ 52:425985:-1:-1:425985:425986:425987
+@@ -81,7 +81,7 @@
+ 78:638977:-1:-1:638977:638978:638979
+ 79:647169:-1:-1:647169:647170:647171
+ 80:655361:-1:-1:655361:655362:655363
+-81:663553:663553:663554-663556:663557:663558:663559
++81:663553:663553:663554-663565:663815:663816:663817
+ 82:671745:-1:-1:671745:671746:671747
+ 83:679937:-1:-1:679937:679938:679939
+ 84:688129:-1:-1:688129:688130:688131
+@@ -96,3 +96,291 @@
+ 93:761857:-1:-1:761857:761858:761859
+ 94:770049:-1:-1:770049:770050:770051
+ 95:778241:-1:-1:778241:778242:778243
++96:786433:-1:-1:786433:786434:786435
++97:794625:-1:-1:794625:794626:794627
++98:802817:-1:-1:802817:802818:802819
++99:811009:-1:-1:811009:811010:811011
++100:819201:-1:-1:819201:819202:819203
++101:827393:-1:-1:827393:827394:827395
++102:835585:-1:-1:835585:835586:835587
++103:843777:-1:-1:843777:843778:843779
++104:851969:-1:-1:851969:851970:851971
++105:860161:-1:-1:860161:860162:860163
++106:868353:-1:-1:868353:868354:868355
++107:876545:-1:-1:876545:876546:876547
++108:884737:-1:-1:884737:884738:884739
++109:892929:-1:-1:892929:892930:892931
++110:901121:-1:-1:901121:901122:901123
++111:909313:-1:-1:909313:909314:909315
++112:917505:-1:-1:917505:917506:917507
++113:925697:-1:-1:925697:925698:925699
++114:933889:-1:-1:933889:933890:933891
++115:942081:-1:-1:942081:942082:942083
++116:950273:-1:-1:950273:950274:950275
++117:958465:-1:-1:958465:958466:958467
++118:966657:-1:-1:966657:966658:966659
++119:974849:-1:-1:974849:974850:974851
++120:983041:-1:-1:983041:983042:983043
++121:991233:-1:-1:991233:991234:991235
++122:999425:-1:-1:999425:999426:999427
++123:1007617:-1:-1:1007617:1007618:1007619
++124:1015809:-1:-1:1015809:1015810:1015811
++125:1024001:1024001:1024002-1024013:1024014:1024015:1024016
++126:1032193:-1:-1:1032193:1032194:1032195
++127:1040385:-1:-1:1040385:1040386:1040387
++128:1048577:-1:-1:1048577:1048578:1048579
++129:1056769:-1:-1:1056769:1056770:1056771
++130:1064961:-1:-1:1064961:1064962:1064963
++131:1073153:-1:-1:1073153:1073154:1073155
++132:1081345:-1:-1:1081345:1081346:1081347
++133:1089537:-1:-1:1089537:1089538:1089539
++134:1097729:-1:-1:1097729:1097730:1097731
++135:1105921:-1:-1:1105921:1105922:1105923
++136:1114113:-1:-1:1114113:1114114:1114115
++137:1122305:-1:-1:1122305:1122306:1122307
++138:1130497:-1:-1:1130497:1130498:1130499
++139:1138689:-1:-1:1138689:1138690:1138691
++140:1146881:-1:-1:1146881:1146882:1146883
++141:1155073:-1:-1:1155073:1155074:1155075
++142:1163265:-1:-1:1163265:1163266:1163267
++143:1171457:-1:-1:1171457:1171458:1171459
++144:1179649:-1:-1:1179649:1179650:1179651
++145:1187841:-1:-1:1187841:1187842:1187843
++146:1196033:-1:-1:1196033:1196034:1196035
++147:1204225:-1:-1:1204225:1204226:1204227
++148:1212417:-1:-1:1212417:1212418:1212419
++149:1220609:-1:-1:1220609:1220610:1220611
++150:1228801:-1:-1:1228801:1228802:1228803
++151:1236993:-1:-1:1236993:1236994:1236995
++152:1245185:-1:-1:1245185:1245186:1245187
++153:1253377:-1:-1:1253377:1253378:1253379
++154:1261569:-1:-1:1261569:1261570:1261571
++155:1269761:-1:-1:1269761:1269762:1269763
++156:1277953:-1:-1:1277953:1277954:1277955
++157:1286145:-1:-1:1286145:1286146:1286147
++158:1294337:-1:-1:1294337:1294338:1294339
++159:1302529:-1:-1:1302529:1302530:1302531
++160:1310721:-1:-1:1310721:1310722:1310723
++161:1318913:-1:-1:1318913:1318914:1318915
++162:1327105:-1:-1:1327105:1327106:1327107
++163:1335297:-1:-1:1335297:1335298:1335299
++164:1343489:-1:-1:1343489:1343490:1343491
++165:1351681:-1:-1:1351681:1351682:1351683
++166:1359873:-1:-1:1359873:1359874:1359875
++167:1368065:-1:-1:1368065:1368066:1368067
++168:1376257:-1:-1:1376257:1376258:1376259
++169:1384449:-1:-1:1384449:1384450:1384451
++170:1392641:-1:-1:1392641:1392642:1392643
++171:1400833:-1:-1:1400833:1400834:1400835
++172:1409025:-1:-1:1409025:1409026:1409027
++173:1417217:-1:-1:1417217:1417218:1417219
++174:1425409:-1:-1:1425409:1425410:1425411
++175:1433601:-1:-1:1433601:1433602:1433603
++176:1441793:-1:-1:1441793:1441794:1441795
++177:1449985:-1:-1:1449985:1449986:1449987
++178:1458177:-1:-1:1458177:1458178:1458179
++179:1466369:-1:-1:1466369:1466370:1466371
++180:1474561:-1:-1:1474561:1474562:1474563
++181:1482753:-1:-1:1482753:1482754:1482755
++182:1490945:-1:-1:1490945:1490946:1490947
++183:1499137:-1:-1:1499137:1499138:1499139
++184:1507329:-1:-1:1507329:1507330:1507331
++185:1515521:-1:-1:1515521:1515522:1515523
++186:1523713:-1:-1:1523713:1523714:1523715
++187:1531905:-1:-1:1531905:1531906:1531907
++188:1540097:-1:-1:1540097:1540098:1540099
++189:1548289:-1:-1:1548289:1548290:1548291
++190:1556481:-1:-1:1556481:1556482:1556483
++191:1564673:-1:-1:1564673:1564674:1564675
++192:1572865:-1:-1:1572865:1572866:1572867
++193:1581057:-1:-1:1581057:1581058:1581059
++194:1589249:-1:-1:1589249:1589250:1589251
++195:1597441:-1:-1:1597441:1597442:1597443
++196:1605633:-1:-1:1605633:1605634:1605635
++197:1613825:-1:-1:1613825:1613826:1613827
++198:1622017:-1:-1:1622017:1622018:1622019
++199:1630209:-1:-1:1630209:1630210:1630211
++200:1638401:-1:-1:1638401:1638402:1638403
++201:1646593:-1:-1:1646593:1646594:1646595
++202:1654785:-1:-1:1654785:1654786:1654787
++203:1662977:-1:-1:1662977:1662978:1662979
++204:1671169:-1:-1:1671169:1671170:1671171
++205:1679361:-1:-1:1679361:1679362:1679363
++206:1687553:-1:-1:1687553:1687554:1687555
++207:1695745:-1:-1:1695745:1695746:1695747
++208:1703937:-1:-1:1703937:1703938:1703939
++209:1712129:-1:-1:1712129:1712130:1712131
++210:1720321:-1:-1:1720321:1720322:1720323
++211:1728513:-1:-1:1728513:1728514:1728515
++212:1736705:-1:-1:1736705:1736706:1736707
++213:1744897:-1:-1:1744897:1744898:1744899
++214:1753089:-1:-1:1753089:1753090:1753091
++215:1761281:-1:-1:1761281:1761282:1761283
++216:1769473:-1:-1:1769473:1769474:1769475
++217:1777665:-1:-1:1777665:1777666:1777667
++218:1785857:-1:-1:1785857:1785858:1785859
++219:1794049:-1:-1:1794049:1794050:1794051
++220:1802241:-1:-1:1802241:1802242:1802243
++221:1810433:-1:-1:1810433:1810434:1810435
++222:1818625:-1:-1:1818625:1818626:1818627
++223:1826817:-1:-1:1826817:1826818:1826819
++224:1835009:-1:-1:1835009:1835010:1835011
++225:1843201:-1:-1:1843201:1843202:1843203
++226:1851393:-1:-1:1851393:1851394:1851395
++227:1859585:-1:-1:1859585:1859586:1859587
++228:1867777:-1:-1:1867777:1867778:1867779
++229:1875969:-1:-1:1875969:1875970:1875971
++230:1884161:-1:-1:1884161:1884162:1884163
++231:1892353:-1:-1:1892353:1892354:1892355
++232:1900545:-1:-1:1900545:1900546:1900547
++233:1908737:-1:-1:1908737:1908738:1908739
++234:1916929:-1:-1:1916929:1916930:1916931
++235:1925121:-1:-1:1925121:1925122:1925123
++236:1933313:-1:-1:1933313:1933314:1933315
++237:1941505:-1:-1:1941505:1941506:1941507
++238:1949697:-1:-1:1949697:1949698:1949699
++239:1957889:-1:-1:1957889:1957890:1957891
++240:1966081:-1:-1:1966081:1966082:1966083
++241:1974273:-1:-1:1974273:1974274:1974275
++242:1982465:-1:-1:1982465:1982466:1982467
++243:1990657:1990657:1990658-1990669:1990670:1990671:1990672
++244:1998849:-1:-1:1998849:1998850:1998851
++245:2007041:-1:-1:2007041:2007042:2007043
++246:2015233:-1:-1:2015233:2015234:2015235
++247:2023425:-1:-1:2023425:2023426:2023427
++248:2031617:-1:-1:2031617:2031618:2031619
++249:2039809:-1:-1:2039809:2039810:2039811
++250:2048001:-1:-1:2048001:2048002:2048003
++251:2056193:-1:-1:2056193:2056194:2056195
++252:2064385:-1:-1:2064385:2064386:2064387
++253:2072577:-1:-1:2072577:2072578:2072579
++254:2080769:-1:-1:2080769:2080770:2080771
++255:2088961:-1:-1:2088961:2088962:2088963
++256:2097153:-1:-1:2097153:2097154:2097155
++257:2105345:-1:-1:2105345:2105346:2105347
++258:2113537:-1:-1:2113537:2113538:2113539
++259:2121729:-1:-1:2121729:2121730:2121731
++260:2129921:-1:-1:2129921:2129922:2129923
++261:2138113:-1:-1:2138113:2138114:2138115
++262:2146305:-1:-1:2146305:2146306:2146307
++263:2154497:-1:-1:2154497:2154498:2154499
++264:2162689:-1:-1:2162689:2162690:2162691
++265:2170881:-1:-1:2170881:2170882:2170883
++266:2179073:-1:-1:2179073:2179074:2179075
++267:2187265:-1:-1:2187265:2187266:2187267
++268:2195457:-1:-1:2195457:2195458:2195459
++269:2203649:-1:-1:2203649:2203650:2203651
++270:2211841:-1:-1:2211841:2211842:2211843
++271:2220033:-1:-1:2220033:2220034:2220035
++272:2228225:-1:-1:2228225:2228226:2228227
++273:2236417:-1:-1:2236417:2236418:2236419
++274:2244609:-1:-1:2244609:2244610:2244611
++275:2252801:-1:-1:2252801:2252802:2252803
++276:2260993:-1:-1:2260993:2260994:2260995
++277:2269185:-1:-1:2269185:2269186:2269187
++278:2277377:-1:-1:2277377:2277378:2277379
++279:2285569:-1:-1:2285569:2285570:2285571
++280:2293761:-1:-1:2293761:2293762:2293763
++281:2301953:-1:-1:2301953:2301954:2301955
++282:2310145:-1:-1:2310145:2310146:2310147
++283:2318337:-1:-1:2318337:2318338:2318339
++284:2326529:-1:-1:2326529:2326530:2326531
++285:2334721:-1:-1:2334721:2334722:2334723
++286:2342913:-1:-1:2342913:2342914:2342915
++287:2351105:-1:-1:2351105:2351106:2351107
++288:2359297:-1:-1:2359297:2359298:2359299
++289:2367489:-1:-1:2367489:2367490:2367491
++290:2375681:-1:-1:2375681:2375682:2375683
++291:2383873:-1:-1:2383873:2383874:2383875
++292:2392065:-1:-1:2392065:2392066:2392067
++293:2400257:-1:-1:2400257:2400258:2400259
++294:2408449:-1:-1:2408449:2408450:2408451
++295:2416641:-1:-1:2416641:2416642:2416643
++296:2424833:-1:-1:2424833:2424834:2424835
++297:2433025:-1:-1:2433025:2433026:2433027
++298:2441217:-1:-1:2441217:2441218:2441219
++299:2449409:-1:-1:2449409:2449410:2449411
++300:2457601:-1:-1:2457601:2457602:2457603
++301:2465793:-1:-1:2465793:2465794:2465795
++302:2473985:-1:-1:2473985:2473986:2473987
++303:2482177:-1:-1:2482177:2482178:2482179
++304:2490369:-1:-1:2490369:2490370:2490371
++305:2498561:-1:-1:2498561:2498562:2498563
++306:2506753:-1:-1:2506753:2506754:2506755
++307:2514945:-1:-1:2514945:2514946:2514947
++308:2523137:-1:-1:2523137:2523138:2523139
++309:2531329:-1:-1:2531329:2531330:2531331
++310:2539521:-1:-1:2539521:2539522:2539523
++311:2547713:-1:-1:2547713:2547714:2547715
++312:2555905:-1:-1:2555905:2555906:2555907
++313:2564097:-1:-1:2564097:2564098:2564099
++314:2572289:-1:-1:2572289:2572290:2572291
++315:2580481:-1:-1:2580481:2580482:2580483
++316:2588673:-1:-1:2588673:2588674:2588675
++317:2596865:-1:-1:2596865:2596866:2596867
++318:2605057:-1:-1:2605057:2605058:2605059
++319:2613249:-1:-1:2613249:2613250:2613251
++320:2621441:-1:-1:2621441:2621442:2621443
++321:2629633:-1:-1:2629633:2629634:2629635
++322:2637825:-1:-1:2637825:2637826:2637827
++323:2646017:-1:-1:2646017:2646018:2646019
++324:2654209:-1:-1:2654209:2654210:2654211
++325:2662401:-1:-1:2662401:2662402:2662403
++326:2670593:-1:-1:2670593:2670594:2670595
++327:2678785:-1:-1:2678785:2678786:2678787
++328:2686977:-1:-1:2686977:2686978:2686979
++329:2695169:-1:-1:2695169:2695170:2695171
++330:2703361:-1:-1:2703361:2703362:2703363
++331:2711553:-1:-1:2711553:2711554:2711555
++332:2719745:-1:-1:2719745:2719746:2719747
++333:2727937:-1:-1:2727937:2727938:2727939
++334:2736129:-1:-1:2736129:2736130:2736131
++335:2744321:-1:-1:2744321:2744322:2744323
++336:2752513:-1:-1:2752513:2752514:2752515
++337:2760705:-1:-1:2760705:2760706:2760707
++338:2768897:-1:-1:2768897:2768898:2768899
++339:2777089:-1:-1:2777089:2777090:2777091
++340:2785281:-1:-1:2785281:2785282:2785283
++341:2793473:-1:-1:2793473:2793474:2793475
++342:2801665:-1:-1:2801665:2801666:2801667
++343:2809857:2809857:2809858-2809869:2809870:2809871:2809872
++344:2818049:-1:-1:2818049:2818050:2818051
++345:2826241:-1:-1:2826241:2826242:2826243
++346:2834433:-1:-1:2834433:2834434:2834435
++347:2842625:-1:-1:2842625:2842626:2842627
++348:2850817:-1:-1:2850817:2850818:2850819
++349:2859009:-1:-1:2859009:2859010:2859011
++350:2867201:-1:-1:2867201:2867202:2867203
++351:2875393:-1:-1:2875393:2875394:2875395
++352:2883585:-1:-1:2883585:2883586:2883587
++353:2891777:-1:-1:2891777:2891778:2891779
++354:2899969:-1:-1:2899969:2899970:2899971
++355:2908161:-1:-1:2908161:2908162:2908163
++356:2916353:-1:-1:2916353:2916354:2916355
++357:2924545:-1:-1:2924545:2924546:2924547
++358:2932737:-1:-1:2932737:2932738:2932739
++359:2940929:-1:-1:2940929:2940930:2940931
++360:2949121:-1:-1:2949121:2949122:2949123
++361:2957313:-1:-1:2957313:2957314:2957315
++362:2965505:-1:-1:2965505:2965506:2965507
++363:2973697:-1:-1:2973697:2973698:2973699
++364:2981889:-1:-1:2981889:2981890:2981891
++365:2990081:-1:-1:2990081:2990082:2990083
++366:2998273:-1:-1:2998273:2998274:2998275
++367:3006465:-1:-1:3006465:3006466:3006467
++368:3014657:-1:-1:3014657:3014658:3014659
++369:3022849:-1:-1:3022849:3022850:3022851
++370:3031041:-1:-1:3031041:3031042:3031043
++371:3039233:-1:-1:3039233:3039234:3039235
++372:3047425:-1:-1:3047425:3047426:3047427
++373:3055617:-1:-1:3055617:3055618:3055619
++374:3063809:-1:-1:3063809:3063810:3063811
++375:3072001:-1:-1:3072001:3072002:3072003
++376:3080193:-1:-1:3080193:3080194:3080195
++377:3088385:-1:-1:3088385:3088386:3088387
++378:3096577:-1:-1:3096577:3096578:3096579
++379:3104769:-1:-1:3104769:3104770:3104771
++380:3112961:-1:-1:3112961:3112962:3112963
++381:3121153:-1:-1:3121153:3121154:3121155
++382:3129345:-1:-1:3129345:3129346:3129347
++383:3137537:-1:-1:3137537:3137538:3137539
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+Exit status is 0
diff --git a/tests/r_expand_full/name b/tests/r_expand_full/name
new file mode 100644
index 0000000..af40cba
--- /dev/null
+++ b/tests/r_expand_full/name
@@ -0,0 +1 @@
+expand a totally full filesystem
diff --git a/tests/r_expand_full/script b/tests/r_expand_full/script
new file mode 100644
index 0000000..a2c09db
--- /dev/null
+++ b/tests/r_expand_full/script
@@ -0,0 +1,79 @@
+if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
+
+FSCK_OPT=-fn
+OUT=$test_name.log
+EXP=$test_dir/expect
+CONF=$TMPFILE.conf
+
+#gzip -d < $EXP.gz > $EXP
+
+cat > $CONF << ENDL
+[fs_types]
+	ext4h = {
+		features = has_journal,extent,huge_file,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,^resize_inode,^meta_bg,^flex_bg
+		blocksize = 1024
+		inode_size = 256
+		make_hugefiles = true
+		hugefiles_dir = /
+		hugefiles_slack = 0
+		hugefiles_name = aaaaa
+		hugefiles_digits = 4
+		hugefiles_size = 1M
+		zero_hugefiles = false
+	}
+ENDL
+
+echo "resize2fs test" > $OUT
+
+MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 786432 >> $OUT 2>&1
+rm -rf $CONF
+
+# dump and check
+$DUMPE2FS -g $TMPFILE 2>&1 >> $OUT.before 2> /dev/null
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+# convert it
+echo "resize2fs test.img" >> $OUT
+dd if=/dev/zero of=$TMPFILE conv=notrunc bs=1 count=1 seek=3221225471 2> /dev/null
+$RESIZE2FS -f $TMPFILE 2>&1 >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+# dump and check
+$DUMPE2FS -g $TMPFILE 2>&1 >> $OUT.after 2> /dev/null
+echo "Change in FS metadata:" >> $OUT
+diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+rm $TMPFILE
+
+#
+# Do the verification
+#
+
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
+mv $OUT.new $OUT
+
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+	echo "$test_name: $test_description: ok"
+	touch $test_name.ok
+else
+	echo "$test_name: $test_description: failed"
+	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+fi
+
+rm $OUT.before $OUT.after
+
+unset IMAGE FSCK_OPT OUT EXP CONF
+
+else #if test -x $RESIZE2FS_EXE -a -x $DEBUGFS_EXE; then
+	echo "$test_name: $test_description: skipped"
+fi
+

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ