Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3ec947c authored by Sukadev Bhattiprolu's avatar Sukadev Bhattiprolu Committed by Al Viro
Browse files

vfs: simple_set_mnt() should return void



simple_set_mnt() is defined as returning 'int' but always returns 0.
Callers assume simple_set_mnt() never fails and don't properly cleanup if
it were to _ever_ fail.  For instance, get_sb_single() and get_sb_nodev()
should:

        up_write(sb->s_unmount);
        deactivate_super(sb);

if simple_set_mnt() fails.

Since simple_set_mnt() never fails, would be cleaner if it did not
return anything.

[akpm@linux-foundation.org: fix build]
Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 585d3bc0
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -81,13 +81,16 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,

	/* go */
	sb->s_flags |= MS_ACTIVE;
	return simple_set_mnt(mnt, sb);
	simple_set_mnt(mnt, sb);

	return 0;

	/* new mountpoint for an already mounted superblock */
already_mounted:
	DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n",
	      mtd->index, mtd->name);
	ret = simple_set_mnt(mnt, sb);
	simple_set_mnt(mnt, sb);
	ret = 0;
	goto out_put;

out_error:
+3 −2
Original line number Diff line number Diff line
@@ -168,8 +168,9 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
	p9stat_free(st);
	kfree(st);

P9_DPRINTK(P9_DEBUG_VFS, " return simple set mount\n");
	return simple_set_mnt(mnt, sb);
P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
	simple_set_mnt(mnt, sb);
	return 0;

release_sb:
	if (sb) {
+2 −1
Original line number Diff line number Diff line
@@ -606,7 +606,8 @@ cifs_get_sb(struct file_system_type *fs_type,
		return rc;
	}
	sb->s_flags |= MS_ACTIVE;
	return simple_set_mnt(mnt, sb);
	simple_set_mnt(mnt, sb);
	return 0;
}

static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+2 −1
Original line number Diff line number Diff line
@@ -454,7 +454,8 @@ static int get_init_pts_sb(struct file_system_type *fs_type, int flags,
		s->s_flags |= MS_ACTIVE;
	}
	do_remount_sb(s, flags, data, 0);
	return simple_set_mnt(mnt, s);
	simple_set_mnt(mnt, s);
	return 0;
}

/*
+2 −1
Original line number Diff line number Diff line
@@ -242,7 +242,8 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
	d_instantiate(dentry, root);
	s->s_root = dentry;
	s->s_flags |= MS_ACTIVE;
	return simple_set_mnt(mnt, s);
	simple_set_mnt(mnt, s);
	return 0;

Enomem:
	up_write(&s->s_umount);
Loading