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

Commit 887b3ece authored by Eric Van Hensbergen's avatar Eric Van Hensbergen
Browse files

9p: fix error path during early mount



There was some cleanup issues during early mount which would trigger
a kernel bug for certain types of failure.  This patch reorganizes the
cleanup to get rid of the bad behavior.

This also merges the 9pnet and 9pnet_fd modules for the purpose of
configuration and initialization.  Keeping the fd transport separate
from the core 9pnet code seemed like a good idea at the time, but in
practice has caused more harm and confusion than good.

Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 332c421e
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
	v9ses->uid = ~0;
	v9ses->dfltuid = V9FS_DEFUID;
	v9ses->dfltgid = V9FS_DEFGID;
	if (data) {
		v9ses->options = kstrdup(data, GFP_KERNEL);
		if (!v9ses->options) {
			P9_DPRINTK(P9_DEBUG_ERROR,
@@ -213,6 +214,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
			retval = -ENOMEM;
			goto error;
		}
	}

	rc = v9fs_parse_options(v9ses);
	if (rc < 0) {
@@ -260,7 +262,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
	return fid;

error:
	v9fs_session_close(v9ses);
	return ERR_PTR(retval);
}

+16 −18
Original line number Diff line number Diff line
@@ -128,29 +128,26 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
	fid = v9fs_session_init(v9ses, dev_name, data);
	if (IS_ERR(fid)) {
		retval = PTR_ERR(fid);
		fid = NULL;
		kfree(v9ses);
		v9ses = NULL;
		goto error;
		goto close_session;
	}

	st = p9_client_stat(fid);
	if (IS_ERR(st)) {
		retval = PTR_ERR(st);
		goto error;
		goto clunk_fid;
	}

	sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
	if (IS_ERR(sb)) {
		retval = PTR_ERR(sb);
		goto error;
		goto free_stat;
	}
	v9fs_fill_super(sb, v9ses, flags);

	inode = v9fs_get_inode(sb, S_IFDIR | mode);
	if (IS_ERR(inode)) {
		retval = PTR_ERR(inode);
		goto error;
		goto release_sb;
	}

	inode->i_uid = uid;
@@ -159,7 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
	root = d_alloc_root(inode);
	if (!root) {
		retval = -ENOMEM;
		goto error;
		goto release_sb;
	}

	sb->s_root = root;
@@ -170,20 +167,21 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,

	return simple_set_mnt(mnt, sb);

error:
release_sb:
	if (sb) {
		up_write(&sb->s_umount);
		deactivate_super(sb);
	}

free_stat:
	kfree(st);
	if (fid)

clunk_fid:
	p9_client_clunk(fid);

	if (v9ses) {
close_session:
	v9fs_session_close(v9ses);
	kfree(v9ses);
	}

	if (sb) {
		up_write(&sb->s_umount);
		deactivate_super(sb);
	}

	return retval;
}
+1 −0
Original line number Diff line number Diff line
@@ -595,4 +595,5 @@ int p9_idpool_check(int id, struct p9_idpool *p);

int p9_error_init(void);
int p9_errstr2errno(char *, int);
int p9_trans_fd_init(void);
#endif /* NET_9P_H */
+0 −1
Original line number Diff line number Diff line
@@ -96,5 +96,4 @@ struct p9_trans_module {
void v9fs_register_trans(struct p9_trans_module *m);
struct p9_trans_module *v9fs_match_trans(const substring_t *name);
struct p9_trans_module *v9fs_default_trans(void);

#endif /* NET_9P_TRANSPORT_H */
+0 −10
Original line number Diff line number Diff line
@@ -13,16 +13,6 @@ menuconfig NET_9P

	  If unsure, say N.

config NET_9P_FD
	depends on NET_9P
	default y if NET_9P
	tristate "9P File Descriptor Transports (Experimental)"
	help
	  This builds support for file descriptor transports for 9p
	  which includes support for TCP/IP, named pipes, or passed
	  file descriptors.  TCP/IP is the default transport for 9p,
	  so if you are going to use 9p, you'll likely want this.

config NET_9P_VIRTIO
	depends on NET_9P && EXPERIMENTAL && VIRTIO
	tristate "9P Virtio Transport (Experimental)"
Loading