Skip to content

Commit 077e073

Browse files
Fabian FrederickAl Viro
authored andcommitted
fs/affs: bugfix: enable writes on OFS disks
We called unconditionally affs_bread_ino() with create 0 resulting in "error (device ...): get_block(): strange block request 0" when trying to write on AFFS OFS format. This patch adds create parameter to that function. 0 for affs_readpage_ofs() 1 for affs_write_begin_ofs() Bug was found here: https://bugzilla.kernel.org/show_bug.cgi?id=114961 Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent a9d6cfb commit 077e073

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/affs/file.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ affs_getemptyblk_ino(struct inode *inode, int block)
499499
}
500500

501501
static int
502-
affs_do_readpage_ofs(struct page *page, unsigned to)
502+
affs_do_readpage_ofs(struct page *page, unsigned to, int create)
503503
{
504504
struct inode *inode = page->mapping->host;
505505
struct super_block *sb = inode->i_sb;
@@ -518,7 +518,7 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
518518
boff = tmp % bsize;
519519

520520
while (pos < to) {
521-
bh = affs_bread_ino(inode, bidx, 0);
521+
bh = affs_bread_ino(inode, bidx, create);
522522
if (IS_ERR(bh))
523523
return PTR_ERR(bh);
524524
tmp = min(bsize - boff, to - pos);
@@ -620,7 +620,7 @@ affs_readpage_ofs(struct file *file, struct page *page)
620620
memset(page_address(page) + to, 0, PAGE_SIZE - to);
621621
}
622622

623-
err = affs_do_readpage_ofs(page, to);
623+
err = affs_do_readpage_ofs(page, to, 0);
624624
if (!err)
625625
SetPageUptodate(page);
626626
unlock_page(page);
@@ -657,7 +657,7 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
657657
return 0;
658658

659659
/* XXX: inefficient but safe in the face of short writes */
660-
err = affs_do_readpage_ofs(page, PAGE_SIZE);
660+
err = affs_do_readpage_ofs(page, PAGE_SIZE, 1);
661661
if (err) {
662662
unlock_page(page);
663663
put_page(page);

0 commit comments

Comments
 (0)