Commit 5672cdfb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull JFFS2, UBI and UBIFS updates from Richard Weinberger:
 "JFFS2:
   - Fix for a deadlock in jffs2_write_begin()

  UBI:
   - Fixes in comments

  UBIFS:
   - Expose error counters in sysfs
   - Many bugfixes found by Hulk Robot and others"

* tag 'for-linus-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  jffs2: GC deadlock reading a page that is used in jffs2_write_begin()
  ubifs: read-only if LEB may always be taken in ubifs_garbage_collect
  ubifs: fix double return leb in ubifs_garbage_collect
  ubifs: fix slab-out-of-bounds in ubifs_change_lp
  ubifs: fix snprintf() length check
  ubifs: Document sysfs nodes
  ubifs: Export filesystem error counters
  ubifs: Error path in ubifs_remount_rw() seems to wrongly free write buffers
  ubifs: Make use of the helper macro kthread_run()
  ubi: Fix a mistake in comment
  ubifs: Fix spelling mistakes
parents 3f67eaed aa39cc67
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
What:		/sys/fs/ubifsX_Y/error_magic
Date:		October 2021
KernelVersion:	5.16
Contact:	linux-mtd@lists.infradead.org
Description:
		Exposes magic errors: every node starts with a magic number.

		This counter keeps track of the number of accesses of nodes
		with a corrupted magic number.

		The counter is reset to 0 with a remount.

What:		/sys/fs/ubifsX_Y/error_node
Date:		October 2021
KernelVersion:	5.16
Contact:	linux-mtd@lists.infradead.org
Description:
		Exposes node errors. Every node embeds its type.

		This counter keeps track of the number of accesses of nodes
		with a corrupted node type.

		The counter is reset to 0 with a remount.

What:		/sys/fs/ubifsX_Y/error_crc
Date:		October 2021
KernelVersion:	5.16
Contact:	linux-mtd@lists.infradead.org
Description:
		Exposes crc errors: every node embeds a crc checksum.

		This counter keeps track of the number of accesses of nodes
		with a bad crc checksum.

		The counter is reset to 0 with a remount.
+1 −0
Original line number Diff line number Diff line
@@ -19603,6 +19603,7 @@ S: Supported
W:	http://www.linux-mtd.infradead.org/doc/ubifs.html
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git next
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs.git fixes
F:	Documentation/ABI/testing/sysfs-fs-ubifs
F:	Documentation/filesystems/ubifs-authentication.rst
F:	Documentation/filesystems/ubifs.rst
F:	fs/ubifs/
+1 −1
Original line number Diff line number Diff line
@@ -562,7 +562,7 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi)
}

/**
 * dbg_debug_exit_dev - free all debugfs files corresponding to device @ubi
 * ubi_debugfs_exit_dev - free all debugfs files corresponding to device @ubi
 * @ubi: UBI device description object
 */
void ubi_debugfs_exit_dev(struct ubi_device *ubi)
+25 −15
Original line number Diff line number Diff line
@@ -136,20 +136,15 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
	struct page *pg;
	struct inode *inode = mapping->host;
	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
	pgoff_t index = pos >> PAGE_SHIFT;
	uint32_t pageofs = index << PAGE_SHIFT;
	int ret = 0;

	pg = grab_cache_page_write_begin(mapping, index, flags);
	if (!pg)
		return -ENOMEM;
	*pagep = pg;

	jffs2_dbg(1, "%s()\n", __func__);

	if (pageofs > inode->i_size) {
		/* Make new hole frag from old EOF to new page */
		struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
		struct jffs2_raw_inode ri;
		struct jffs2_full_dnode *fn;
		uint32_t alloc_len;
@@ -160,7 +155,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
		ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
					  ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
		if (ret)
			goto out_page;
			goto out_err;

		mutex_lock(&f->sem);
		memset(&ri, 0, sizeof(ri));
@@ -190,7 +185,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
			ret = PTR_ERR(fn);
			jffs2_complete_reservation(c);
			mutex_unlock(&f->sem);
			goto out_page;
			goto out_err;
		}
		ret = jffs2_add_full_dnode_to_inode(c, f, fn);
		if (f->metadata) {
@@ -205,13 +200,26 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
			jffs2_free_full_dnode(fn);
			jffs2_complete_reservation(c);
			mutex_unlock(&f->sem);
			goto out_page;
			goto out_err;
		}
		jffs2_complete_reservation(c);
		inode->i_size = pageofs;
		mutex_unlock(&f->sem);
	}

	/*
	 * While getting a page and reading data in, lock c->alloc_sem until
	 * the page is Uptodate. Otherwise GC task may attempt to read the same
	 * page in read_cache_page(), which causes a deadlock.
	 */
	mutex_lock(&c->alloc_sem);
	pg = grab_cache_page_write_begin(mapping, index, flags);
	if (!pg) {
		ret = -ENOMEM;
		goto release_sem;
	}
	*pagep = pg;

	/*
	 * Read in the page if it wasn't already present. Cannot optimize away
	 * the whole page write case until jffs2_write_end can handle the
@@ -221,15 +229,17 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
		mutex_lock(&f->sem);
		ret = jffs2_do_readpage_nolock(inode, pg);
		mutex_unlock(&f->sem);
		if (ret)
			goto out_page;
		if (ret) {
			unlock_page(pg);
			put_page(pg);
			goto release_sem;
		}
	}
	jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
	return ret;

out_page:
	unlock_page(pg);
	put_page(pg);
release_sem:
	mutex_unlock(&c->alloc_sem);
out_err:
	return ret;
}

+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ ubifs-y += shrinker.o journal.o file.o dir.o super.o sb.o io.o
ubifs-y += tnc.o master.o scan.o replay.o log.o commit.o gc.o orphan.o
ubifs-y += budget.o find.o tnc_commit.o compress.o lpt.o lprops.o
ubifs-y += recovery.o ioctl.o lpt_commit.o tnc_misc.o debug.o
ubifs-y += misc.o
ubifs-y += misc.o sysfs.o
ubifs-$(CONFIG_FS_ENCRYPTION) += crypto.o
ubifs-$(CONFIG_UBIFS_FS_XATTR) += xattr.o
ubifs-$(CONFIG_UBIFS_FS_AUTHENTICATION) += auth.o
Loading