All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] fsfreeze: return EINTR from mnt_want_write and mnt_want_write_file
@ 2013-07-04 16:19 Gmail
  0 siblings, 0 replies; 5+ messages in thread
From: Gmail @ 2013-07-04 16:19 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, Marco Stornelli, H. Peter Anvin, Jan Kara, linux-kernel

Replaced sb_start_write with sb_start_write_killable inside
mnt_want_write and mnt_want_write_file.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/namei.c     |    6 ++++++
 fs/namespace.c |    8 ++++++--
 ipc/mqueue.c   |    6 +++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 9ed9361..d8e3eab 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2750,6 +2750,8 @@ static int do_last(struct nameidata *nd, struct path *path,
 retry_lookup:
 	if (op->open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
 		error = mnt_want_write(nd->path.mnt);
+		if (error == -EINTR)
+			goto out;
 		if (!error)
 			got_write = true;
 		/*
@@ -3053,6 +3055,10 @@ struct dentry *kern_path_create(int dfd, const char *pathname,
 
 	/* don't fail immediately if it's r/o, at least try to report other errors */
 	err2 = mnt_want_write(nd.path.mnt);
+	if (err2 == -EINTR) {
+		dentry = ERR_PTR(-EINTR);
+		goto out;
+	}
 	/*
 	 * Do the final lookup.
 	 */
diff --git a/fs/namespace.c b/fs/namespace.c
index 7b1ca9b..7a7bc97 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -345,7 +345,9 @@ int mnt_want_write(struct vfsmount *m)
 {
 	int ret;
 
-	sb_start_write(m->mnt_sb);
+	ret = sb_start_write_killable(m->mnt_sb);
+	if (ret < 0)
+		return ret;
 	ret = __mnt_want_write(m);
 	if (ret)
 		sb_end_write(m->mnt_sb);
@@ -405,7 +407,9 @@ int mnt_want_write_file(struct file *file)
 {
 	int ret;
 
-	sb_start_write(file->f_path.mnt->mnt_sb);
+	ret = sb_start_write_killable(file->f_path.mnt->mnt_sb);
+	if (ret < 0)
+		return ret;
 	ret = __mnt_want_write_file(file);
 	if (ret)
 		sb_end_write(file->f_path.mnt->mnt_sb);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index e4e47f6..e8fdc03 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -800,7 +800,11 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
 	if (fd < 0)
 		goto out_putname;
 
-	ro = mnt_want_write(mnt);	/* we'll drop it in any case */
+	ro = mnt_want_write(mnt);
+	if (ro == -EINTR) {
+		fd = ro;
+		goto out_putname;
+	}
 	error = 0;
 	mutex_lock(&root->d_inode->i_mutex);
 	path.dentry = lookup_one_len(name->name, root, strlen(name->name));
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] fsfreeze: return EINTR from mnt_want_write and mnt_want_write_file
@ 2013-05-04  6:50 Marco Stornelli
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Stornelli @ 2013-05-04  6:50 UTC (permalink / raw)
  To: linux-fsdevel
  Cc: Alexander Viro, J. Bruce Fields, Chuck Lever, linux-kernel, Jan Kara

Replaced sb_start_write with sb_start_write_killable inside
mnt_want_write and mnt_want_write_file.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/namei.c     |    6 ++++++
 fs/namespace.c |    8 ++++++--
 ipc/mqueue.c   |    6 +++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 57ae9c8..5f239fd 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2750,6 +2750,8 @@ static int do_last(struct nameidata *nd, struct path *path,
 retry_lookup:
 	if (op->open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
 		error = mnt_want_write(nd->path.mnt);
+		if (error == -EINTR)
+			goto out;
 		if (!error)
 			got_write = true;
 		/*
@@ -3053,6 +3055,10 @@ struct dentry *kern_path_create(int dfd, const char *pathname,
 
 	/* don't fail immediately if it's r/o, at least try to report other errors */
 	err2 = mnt_want_write(nd.path.mnt);
+	if (err2 == -EINTR) {
+		dentry = ERR_PTR(-EINTR);
+		goto out;
+	}
 	/*
 	 * Do the final lookup.
 	 */
diff --git a/fs/namespace.c b/fs/namespace.c
index b4f96a5..2028e74 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -345,7 +345,9 @@ int mnt_want_write(struct vfsmount *m)
 {
 	int ret;
 
-	sb_start_write(m->mnt_sb);
+	ret = sb_start_write_killable(m->mnt_sb);
+	if (ret < 0)
+		return ret;
 	ret = __mnt_want_write(m);
 	if (ret)
 		sb_end_write(m->mnt_sb);
@@ -405,7 +407,9 @@ int mnt_want_write_file(struct file *file)
 {
 	int ret;
 
-	sb_start_write(file->f_path.mnt->mnt_sb);
+	ret = sb_start_write_killable(file->f_path.mnt->mnt_sb);
+	if (ret < 0)
+		return ret;
 	ret = __mnt_want_write_file(file);
 	if (ret)
 		sb_end_write(file->f_path.mnt->mnt_sb);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index e4e47f6..e8fdc03 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -800,7 +800,11 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
 	if (fd < 0)
 		goto out_putname;
 
-	ro = mnt_want_write(mnt);	/* we'll drop it in any case */
+	ro = mnt_want_write(mnt);
+	if (ro == -EINTR) {
+		fd = ro;
+		goto out_putname;
+	}
 	error = 0;
 	mutex_lock(&root->d_inode->i_mutex);
 	path.dentry = lookup_one_len(name->name, root, strlen(name->name));
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/4] fsfreeze: return EINTR from mnt_want_write and mnt_want_write_file
  2013-04-29 12:35 ` Jan Kara
@ 2013-04-30  6:18   ` Marco Stornelli
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Stornelli @ 2013-04-30  6:18 UTC (permalink / raw)
  To: Jan Kara; +Cc: Linux FS Devel, Alexander Viro, Linux Kernel

2013/4/29 Jan Kara <jack@suse.cz>:
> On Fri 26-04-13 10:53:27, Marco Stornelli wrote:
>> Replaced sb_start_write with sb_start_write_killable inside
>> mnt_want_write and mnt_want_write_file.
>   The patch looks good. You can add:
> Reviewed-by: Jan Kara <jack@suse.cz>
>                                                         Honza
>>

Thanks for the review. I'll submit the patches for mainline in the
current merge-window.

Regards,

Marco

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/4] fsfreeze: return EINTR from mnt_want_write and mnt_want_write_file
  2013-04-26  8:53 Marco Stornelli
@ 2013-04-29 12:35 ` Jan Kara
  2013-04-30  6:18   ` Marco Stornelli
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2013-04-29 12:35 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: linux-fsdevel, Alexander Viro, linux-kernel, Jan Kara

On Fri 26-04-13 10:53:27, Marco Stornelli wrote:
> Replaced sb_start_write with sb_start_write_killable inside
> mnt_want_write and mnt_want_write_file.
  The patch looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
							Honza
> 
> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
> ---
>  fs/namei.c     |    6 ++++++
>  fs/namespace.c |    8 ++++++--
>  ipc/mqueue.c   |    6 +++++-
>  3 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 57ae9c8..5f239fd 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -2750,6 +2750,8 @@ static int do_last(struct nameidata *nd, struct path *path,
>  retry_lookup:
>  	if (op->open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
>  		error = mnt_want_write(nd->path.mnt);
> +		if (error == -EINTR)
> +			goto out;
>  		if (!error)
>  			got_write = true;
>  		/*
> @@ -3053,6 +3055,10 @@ struct dentry *kern_path_create(int dfd, const char *pathname,
>  
>  	/* don't fail immediately if it's r/o, at least try to report other errors */
>  	err2 = mnt_want_write(nd.path.mnt);
> +	if (err2 == -EINTR) {
> +		dentry = ERR_PTR(-EINTR);
> +		goto out;
> +	}
>  	/*
>  	 * Do the final lookup.
>  	 */
> diff --git a/fs/namespace.c b/fs/namespace.c
> index af73554..db09ecb 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -344,7 +344,9 @@ int mnt_want_write(struct vfsmount *m)
>  {
>  	int ret;
>  
> -	sb_start_write(m->mnt_sb);
> +	ret = sb_start_write_killable(m->mnt_sb);
> +	if (ret < 0)
> +		return ret;
>  	ret = __mnt_want_write(m);
>  	if (ret)
>  		sb_end_write(m->mnt_sb);
> @@ -404,7 +406,9 @@ int mnt_want_write_file(struct file *file)
>  {
>  	int ret;
>  
> -	sb_start_write(file->f_path.mnt->mnt_sb);
> +	ret = sb_start_write_killable(file->f_path.mnt->mnt_sb);
> +	if (ret < 0)
> +		return ret;
>  	ret = __mnt_want_write_file(file);
>  	if (ret)
>  		sb_end_write(file->f_path.mnt->mnt_sb);
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index e4e47f6..e8fdc03 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -800,7 +800,11 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
>  	if (fd < 0)
>  		goto out_putname;
>  
> -	ro = mnt_want_write(mnt);	/* we'll drop it in any case */
> +	ro = mnt_want_write(mnt);
> +	if (ro == -EINTR) {
> +		fd = ro;
> +		goto out_putname;
> +	}
>  	error = 0;
>  	mutex_lock(&root->d_inode->i_mutex);
>  	path.dentry = lookup_one_len(name->name, root, strlen(name->name));
> -- 
> 1.7.3.4
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] fsfreeze: return EINTR from mnt_want_write and mnt_want_write_file
@ 2013-04-26  8:53 Marco Stornelli
  2013-04-29 12:35 ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Stornelli @ 2013-04-26  8:53 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Alexander Viro, linux-kernel, Jan Kara

Replaced sb_start_write with sb_start_write_killable inside
mnt_want_write and mnt_want_write_file.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
 fs/namei.c     |    6 ++++++
 fs/namespace.c |    8 ++++++--
 ipc/mqueue.c   |    6 +++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 57ae9c8..5f239fd 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2750,6 +2750,8 @@ static int do_last(struct nameidata *nd, struct path *path,
 retry_lookup:
 	if (op->open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
 		error = mnt_want_write(nd->path.mnt);
+		if (error == -EINTR)
+			goto out;
 		if (!error)
 			got_write = true;
 		/*
@@ -3053,6 +3055,10 @@ struct dentry *kern_path_create(int dfd, const char *pathname,
 
 	/* don't fail immediately if it's r/o, at least try to report other errors */
 	err2 = mnt_want_write(nd.path.mnt);
+	if (err2 == -EINTR) {
+		dentry = ERR_PTR(-EINTR);
+		goto out;
+	}
 	/*
 	 * Do the final lookup.
 	 */
diff --git a/fs/namespace.c b/fs/namespace.c
index af73554..db09ecb 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -344,7 +344,9 @@ int mnt_want_write(struct vfsmount *m)
 {
 	int ret;
 
-	sb_start_write(m->mnt_sb);
+	ret = sb_start_write_killable(m->mnt_sb);
+	if (ret < 0)
+		return ret;
 	ret = __mnt_want_write(m);
 	if (ret)
 		sb_end_write(m->mnt_sb);
@@ -404,7 +406,9 @@ int mnt_want_write_file(struct file *file)
 {
 	int ret;
 
-	sb_start_write(file->f_path.mnt->mnt_sb);
+	ret = sb_start_write_killable(file->f_path.mnt->mnt_sb);
+	if (ret < 0)
+		return ret;
 	ret = __mnt_want_write_file(file);
 	if (ret)
 		sb_end_write(file->f_path.mnt->mnt_sb);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index e4e47f6..e8fdc03 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -800,7 +800,11 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
 	if (fd < 0)
 		goto out_putname;
 
-	ro = mnt_want_write(mnt);	/* we'll drop it in any case */
+	ro = mnt_want_write(mnt);
+	if (ro == -EINTR) {
+		fd = ro;
+		goto out_putname;
+	}
 	error = 0;
 	mutex_lock(&root->d_inode->i_mutex);
 	path.dentry = lookup_one_len(name->name, root, strlen(name->name));
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-04 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 16:19 [PATCH 4/4] fsfreeze: return EINTR from mnt_want_write and mnt_want_write_file Gmail
  -- strict thread matches above, loose matches on Subject: below --
2013-05-04  6:50 Marco Stornelli
2013-04-26  8:53 Marco Stornelli
2013-04-29 12:35 ` Jan Kara
2013-04-30  6:18   ` Marco Stornelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.