Commit 6951abe8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull jffs2 updates from Richard Weinberger:

 - Fix illegal memory access in jffs2_free_inode()

 - Kernel-doc fixes

 - print symbolic error names

* tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  jffs2: Fix potential illegal address access in jffs2_free_inode
  jffs2: Simplify the allocation of slab caches
  jffs2: nodemgmt: fix kernel-doc comments
  jffs2: print symbolic error name instead of error code
parents 2313022e af9a8730
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)

	tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index);
	if (IS_ERR(tsk)) {
		pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n",
			-PTR_ERR(tsk));
		pr_warn("fork failed for JFFS2 garbage collect thread: %pe\n",
			tsk);
		complete(&c->gc_thread_exit);
		ret = PTR_ERR(tsk);
	} else {
+8 −24
Original line number Diff line number Diff line
@@ -33,27 +33,19 @@ static struct kmem_cache *xattr_ref_cache;

int __init jffs2_create_slab_caches(void)
{
	full_dnode_slab = kmem_cache_create("jffs2_full_dnode",
					    sizeof(struct jffs2_full_dnode),
					    0, 0, NULL);
	full_dnode_slab = KMEM_CACHE(jffs2_full_dnode, 0);
	if (!full_dnode_slab)
		goto err;

	raw_dirent_slab = kmem_cache_create("jffs2_raw_dirent",
					    sizeof(struct jffs2_raw_dirent),
					    0, SLAB_HWCACHE_ALIGN, NULL);
	raw_dirent_slab = KMEM_CACHE(jffs2_raw_dirent, SLAB_HWCACHE_ALIGN);
	if (!raw_dirent_slab)
		goto err;

	raw_inode_slab = kmem_cache_create("jffs2_raw_inode",
					   sizeof(struct jffs2_raw_inode),
					   0, SLAB_HWCACHE_ALIGN, NULL);
	raw_inode_slab = KMEM_CACHE(jffs2_raw_inode, SLAB_HWCACHE_ALIGN);
	if (!raw_inode_slab)
		goto err;

	tmp_dnode_info_slab = kmem_cache_create("jffs2_tmp_dnode",
						sizeof(struct jffs2_tmp_dnode_info),
						0, 0, NULL);
	tmp_dnode_info_slab = KMEM_CACHE(jffs2_tmp_dnode_info, 0);
	if (!tmp_dnode_info_slab)
		goto err;

@@ -63,28 +55,20 @@ int __init jffs2_create_slab_caches(void)
	if (!raw_node_ref_slab)
		goto err;

	node_frag_slab = kmem_cache_create("jffs2_node_frag",
					   sizeof(struct jffs2_node_frag),
					   0, 0, NULL);
	node_frag_slab = KMEM_CACHE(jffs2_node_frag, 0);
	if (!node_frag_slab)
		goto err;

	inode_cache_slab = kmem_cache_create("jffs2_inode_cache",
					     sizeof(struct jffs2_inode_cache),
					     0, 0, NULL);
	inode_cache_slab = KMEM_CACHE(jffs2_inode_cache, 0);
	if (!inode_cache_slab)
		goto err;

#ifdef CONFIG_JFFS2_FS_XATTR
	xattr_datum_cache = kmem_cache_create("jffs2_xattr_datum",
					     sizeof(struct jffs2_xattr_datum),
					     0, 0, NULL);
	xattr_datum_cache = KMEM_CACHE(jffs2_xattr_datum, 0);
	if (!xattr_datum_cache)
		goto err;

	xattr_ref_cache = kmem_cache_create("jffs2_xattr_ref",
					   sizeof(struct jffs2_xattr_ref),
					   0, 0, NULL);
	xattr_ref_cache = KMEM_CACHE(jffs2_xattr_ref, 0);
	if (!xattr_ref_cache)
		goto err;
#endif
+15 −9
Original line number Diff line number Diff line
@@ -49,28 +49,31 @@ static int jffs2_rp_can_write(struct jffs2_sb_info *c)
	return 0;
}

static int jffs2_do_reserve_space(struct jffs2_sb_info *c,  uint32_t minsize,
				  uint32_t *len, uint32_t sumsize);

/**
 *	jffs2_reserve_space - request physical space to write nodes to flash
 *	@c: superblock info
 *	@minsize: Minimum acceptable size of allocation
 *	@len: Returned value of allocation length
 *	@prio: Allocation type - ALLOC_{NORMAL,DELETION}
 *	@sumsize: summary size requested or JFFS2_SUMMARY_NOSUM_SIZE for no summary
 *
 *	Requests a block of physical space on the flash.
 *
 *	Requests a block of physical space on the flash. Returns zero for success
 *	and puts 'len' into the appropriate place, or returns -ENOSPC or other 
 *	error if appropriate. Doesn't return len since that's 
 *	Returns: %0 for success	and puts 'len' into the appropriate place,
 *	or returns -ENOSPC or other error if appropriate.
 *	Doesn't return len since that's already returned in @len.
 *
 *	If it returns zero, jffs2_reserve_space() also downs the per-filesystem
 *	If it returns %0, jffs2_reserve_space() also downs the per-filesystem
 *	allocation semaphore, to prevent more than one allocation from being
 *	active at any time. The semaphore is later released by jffs2_commit_allocation()
 *	active at any time. The semaphore is later released by jffs2_commit_allocation().
 *
 *	jffs2_reserve_space() may trigger garbage collection in order to make room
 *	for the requested allocation.
 */

static int jffs2_do_reserve_space(struct jffs2_sb_info *c,  uint32_t minsize,
				  uint32_t *len, uint32_t sumsize);

int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
			uint32_t *len, int prio, uint32_t sumsize)
{
@@ -488,13 +491,16 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
/**
 *	jffs2_add_physical_node_ref - add a physical node reference to the list
 *	@c: superblock info
 *	@new: new node reference to add
 *	@ofs: offset in the block
 *	@len: length of this physical node
 *	@ic: inode cache pointer
 *
 *	Should only be used to report nodes for which space has been allocated
 *	by jffs2_reserve_space.
 *
 *	Must be called with the alloc_sem held.
 *
 *	Returns: pointer to new node on success or -errno code on error
 */

struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ static void jffs2_i_init_once(void *foo)
	struct jffs2_inode_info *f = foo;

	mutex_init(&f->sem);
	f->target = NULL;
	inode_init_once(&f->vfs_inode);
}