linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes"
@ 2018-09-16 21:57 Richard Weinberger
  2018-09-20  2:30 ` Joel Stanley
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2018-09-16 21:57 UTC (permalink / raw)
  To: linux-mtd; +Cc: linux-kernel, koen.vandeputte, Richard Weinberger, stable

This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
UBIFS wants to assert that xattr operations are only issued on files
with positive link count. The said patch made this operations return
-ENOENT for unlinked files such that the asserts will no longer trigger.
This was wrong since xattr operations are perfectly fine on unlinked
files.
Instead the assertions need to be fixed/removed.

Cc: <stable@vger.kernel.org>
Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/xattr.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 61afdfee4b28..f5ad1ede7990 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
 	ui->data_len = size;
 
 	mutex_lock(&host_ui->ui_mutex);
-
-	if (!host->i_nlink) {
-		err = -ENOENT;
-		goto out_noent;
-	}
-
 	host->i_ctime = current_time(host);
 	host_ui->xattr_cnt += 1;
 	host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
@@ -190,7 +184,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
 	host_ui->xattr_size -= CALC_XATTR_BYTES(size);
 	host_ui->xattr_names -= fname_len(nm);
 	host_ui->flags &= ~UBIFS_CRYPT_FL;
-out_noent:
 	mutex_unlock(&host_ui->ui_mutex);
 out_free:
 	make_bad_inode(inode);
@@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
 	mutex_unlock(&ui->ui_mutex);
 
 	mutex_lock(&host_ui->ui_mutex);
-
-	if (!host->i_nlink) {
-		err = -ENOENT;
-		goto out_noent;
-	}
-
 	host->i_ctime = current_time(host);
 	host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
 	host_ui->xattr_size += CALC_XATTR_BYTES(size);
@@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
 out_cancel:
 	host_ui->xattr_size -= CALC_XATTR_BYTES(size);
 	host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
-out_noent:
 	mutex_unlock(&host_ui->ui_mutex);
 	make_bad_inode(inode);
 out_free:
@@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
 		return err;
 
 	mutex_lock(&host_ui->ui_mutex);
-
-	if (!host->i_nlink) {
-		err = -ENOENT;
-		goto out_noent;
-	}
-
 	host->i_ctime = current_time(host);
 	host_ui->xattr_cnt -= 1;
 	host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
@@ -521,7 +501,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
 	host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
 	host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
 	host_ui->xattr_names += fname_len(nm);
-out_noent:
 	mutex_unlock(&host_ui->ui_mutex);
 	ubifs_release_budget(c, &req);
 	make_bad_inode(inode);
@@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
 
 	ubifs_assert(c, inode_is_locked(host));
 
-	if (!host->i_nlink)
-		return -ENOENT;
-
 	if (fname_len(&nm) > UBIFS_MAX_NLEN)
 		return -ENAMETOOLONG;
 
-- 
2.19.0


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

* Re: [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes"
  2018-09-16 21:57 [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes" Richard Weinberger
@ 2018-09-20  2:30 ` Joel Stanley
  2018-09-20  7:10   ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Stanley @ 2018-09-20  2:30 UTC (permalink / raw)
  To: Richard Weinberger, Greg KH
  Cc: linux-mtd, Linux Kernel Mailing List, koen.vandeputte, Eddie James

On Mon, 17 Sep 2018 at 07:30, Richard Weinberger <richard@nod.at> wrote:
>
> This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
> UBIFS wants to assert that xattr operations are only issued on files
> with positive link count. The said patch made this operations return
> -ENOENT for unlinked files such that the asserts will no longer trigger.
> This was wrong since xattr operations are perfectly fine on unlinked
> files.
> Instead the assertions need to be fixed/removed.
>
> Cc: <stable@vger.kernel.org>
> Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
> Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
> Signed-off-by: Richard Weinberger <richard@nod.at>

The bad commit 11a6fc3dc743 was included in 4.18.7, and broke our
systems which use overlayfs on top of ubifs.

This patch didn't apply cleanly for me to 4.18.8 (an encoding issue?),
but I did a revert of the offending commit which did the trick.

Tested-by: Joel Stanley <joel@jms.id.au>

Cheers,

Joel


> ---
>  fs/ubifs/xattr.c | 24 ------------------------
>  1 file changed, 24 deletions(-)
>
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 61afdfee4b28..f5ad1ede7990 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
>         ui->data_len = size;
>
>         mutex_lock(&host_ui->ui_mutex);
> -
> -       if (!host->i_nlink) {
> -               err = -ENOENT;
> -               goto out_noent;
> -       }
> -
>         host->i_ctime = current_time(host);
>         host_ui->xattr_cnt += 1;
>         host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
> @@ -190,7 +184,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
>         host_ui->xattr_size -= CALC_XATTR_BYTES(size);
>         host_ui->xattr_names -= fname_len(nm);
>         host_ui->flags &= ~UBIFS_CRYPT_FL;
> -out_noent:
>         mutex_unlock(&host_ui->ui_mutex);
>  out_free:
>         make_bad_inode(inode);
> @@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
>         mutex_unlock(&ui->ui_mutex);
>
>         mutex_lock(&host_ui->ui_mutex);
> -
> -       if (!host->i_nlink) {
> -               err = -ENOENT;
> -               goto out_noent;
> -       }
> -
>         host->i_ctime = current_time(host);
>         host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
>         host_ui->xattr_size += CALC_XATTR_BYTES(size);
> @@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
>  out_cancel:
>         host_ui->xattr_size -= CALC_XATTR_BYTES(size);
>         host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
> -out_noent:
>         mutex_unlock(&host_ui->ui_mutex);
>         make_bad_inode(inode);
>  out_free:
> @@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
>                 return err;
>
>         mutex_lock(&host_ui->ui_mutex);
> -
> -       if (!host->i_nlink) {
> -               err = -ENOENT;
> -               goto out_noent;
> -       }
> -
>         host->i_ctime = current_time(host);
>         host_ui->xattr_cnt -= 1;
>         host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
> @@ -521,7 +501,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
>         host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
>         host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
>         host_ui->xattr_names += fname_len(nm);
> -out_noent:
>         mutex_unlock(&host_ui->ui_mutex);
>         ubifs_release_budget(c, &req);
>         make_bad_inode(inode);
> @@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
>
>         ubifs_assert(c, inode_is_locked(host));
>
> -       if (!host->i_nlink)
> -               return -ENOENT;
> -
>         if (fname_len(&nm) > UBIFS_MAX_NLEN)
>                 return -ENAMETOOLONG;
>
> --
> 2.19.0
>

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

* Re: [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes"
  2018-09-20  2:30 ` Joel Stanley
@ 2018-09-20  7:10   ` Richard Weinberger
  2018-09-21  1:42     ` Joel Stanley
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2018-09-20  7:10 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Greg KH, linux-mtd, Linux Kernel Mailing List, koen.vandeputte,
	Eddie James

Am Donnerstag, 20. September 2018, 04:30:41 CEST schrieb Joel Stanley:
> On Mon, 17 Sep 2018 at 07:30, Richard Weinberger <richard@nod.at> wrote:
> >
> > This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
> > UBIFS wants to assert that xattr operations are only issued on files
> > with positive link count. The said patch made this operations return
> > -ENOENT for unlinked files such that the asserts will no longer trigger.
> > This was wrong since xattr operations are perfectly fine on unlinked
> > files.
> > Instead the assertions need to be fixed/removed.
> >
> > Cc: <stable@vger.kernel.org>
> > Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
> > Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
> > Signed-off-by: Richard Weinberger <richard@nod.at>
> 
> The bad commit 11a6fc3dc743 was included in 4.18.7, and broke our
> systems which use overlayfs on top of ubifs.
> 
> This patch didn't apply cleanly for me to 4.18.8 (an encoding issue?),
> but I did a revert of the offending commit which did the trick.
> 
> Tested-by: Joel Stanley <joel@jms.id.au>

Thanks a lot for testing and sorry for the breakage. :-(

Thanks,
//richard



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

* Re: [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes"
  2018-09-20  7:10   ` Richard Weinberger
@ 2018-09-21  1:42     ` Joel Stanley
  2018-09-21  6:29       ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Stanley @ 2018-09-21  1:42 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Greg KH, linux-mtd, Linux Kernel Mailing List, koen.vandeputte,
	Eddie James

On Thu, 20 Sep 2018 at 16:40, Richard Weinberger <richard@nod.at> wrote:
>
> Am Donnerstag, 20. September 2018, 04:30:41 CEST schrieb Joel Stanley:
> > On Mon, 17 Sep 2018 at 07:30, Richard Weinberger <richard@nod.at> wrote:
> > >
> > > This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
> > > UBIFS wants to assert that xattr operations are only issued on files
> > > with positive link count. The said patch made this operations return
> > > -ENOENT for unlinked files such that the asserts will no longer trigger.
> > > This was wrong since xattr operations are perfectly fine on unlinked
> > > files.
> > > Instead the assertions need to be fixed/removed.
> > >
> > > Cc: <stable@vger.kernel.org>
> > > Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
> > > Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
> > > Signed-off-by: Richard Weinberger <richard@nod.at>
> >
> > The bad commit 11a6fc3dc743 was included in 4.18.7, and broke our
> > systems which use overlayfs on top of ubifs.
> >
> > This patch didn't apply cleanly for me to 4.18.8 (an encoding issue?),
> > but I did a revert of the offending commit which did the trick.
> >
> > Tested-by: Joel Stanley <joel@jms.id.au>
>
> Thanks a lot for testing and sorry for the breakage. :-(

No worries. How do you plan to get this fix in? It would be good to
get it in master asap, so we can get it backported in the next wave of
stable releases.

Cheers,

Joel

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

* Re: [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes"
  2018-09-21  1:42     ` Joel Stanley
@ 2018-09-21  6:29       ` Richard Weinberger
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2018-09-21  6:29 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Greg KH, linux-mtd, Linux Kernel Mailing List, koen.vandeputte,
	Eddie James

Am Freitag, 21. September 2018, 03:42:25 CEST schrieb Joel Stanley:
> On Thu, 20 Sep 2018 at 16:40, Richard Weinberger <richard@nod.at> wrote:
> >
> > Am Donnerstag, 20. September 2018, 04:30:41 CEST schrieb Joel Stanley:
> > > On Mon, 17 Sep 2018 at 07:30, Richard Weinberger <richard@nod.at> wrote:
> > > >
> > > > This reverts commit 11a6fc3dc743e22fb50f2196ec55bee5140d3c52.
> > > > UBIFS wants to assert that xattr operations are only issued on files
> > > > with positive link count. The said patch made this operations return
> > > > -ENOENT for unlinked files such that the asserts will no longer trigger.
> > > > This was wrong since xattr operations are perfectly fine on unlinked
> > > > files.
> > > > Instead the assertions need to be fixed/removed.
> > > >
> > > > Cc: <stable@vger.kernel.org>
> > > > Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
> > > > Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
> > > > Signed-off-by: Richard Weinberger <richard@nod.at>
> > >
> > > The bad commit 11a6fc3dc743 was included in 4.18.7, and broke our
> > > systems which use overlayfs on top of ubifs.
> > >
> > > This patch didn't apply cleanly for me to 4.18.8 (an encoding issue?),
> > > but I did a revert of the offending commit which did the trick.
> > >
> > > Tested-by: Joel Stanley <joel@jms.id.au>
> >
> > Thanks a lot for testing and sorry for the breakage. :-(
> 
> No worries. How do you plan to get this fix in? It would be good to
> get it in master asap, so we can get it backported in the next wave of
> stable releases.

Since yesterday it is in -next, I'll send a pull request to Linus^WGreg later
this day.

Thanks,
//richard



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

end of thread, other threads:[~2018-09-21  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-16 21:57 [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes" Richard Weinberger
2018-09-20  2:30 ` Joel Stanley
2018-09-20  7:10   ` Richard Weinberger
2018-09-21  1:42     ` Joel Stanley
2018-09-21  6:29       ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).