1 From a99708737f566c70651015332e89d0d3b1eb5529 Mon Sep 17 00:00:00 2001
2 From: Koen Vandeputte <koen.vandeputte@ncentric.com>
3 Date: Mon, 17 Sep 2018 10:13:09 +0200
4 Subject: [PATCH] Revert "ubifs: xattr: Don't operate on deleted inodes"
6 This reverts commit 8a23348d76a1e7716da6e76383281ac82fc071cf.
8 UBIFS wants to assert that xattr operations are only issued on files
9 with positive link count. The said patch made this operations return
10 -ENOENT for unlinked files such that the asserts will no longer trigger.
11 This was wrong since xattr operations are perfectly fine on unlinked
13 Instead the assertions need to be fixed/removed.
15 Fixes: 11a6fc3dc743 ("ubifs: xattr: Don't operate on deleted inodes")
16 Reported-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
17 Signed-off-by: Richard Weinberger <richard@nod.at>
19 fs/ubifs/xattr.c | 24 ------------------------
20 1 file changed, 24 deletions(-)
22 --- a/fs/ubifs/xattr.c
23 +++ b/fs/ubifs/xattr.c
24 @@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_inf
27 mutex_lock(&host_ui->ui_mutex);
29 - if (!host->i_nlink) {
34 host->i_ctime = current_time(host);
35 host_ui->xattr_cnt += 1;
36 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
37 @@ -189,7 +183,6 @@ out_cancel:
38 host_ui->xattr_size -= CALC_XATTR_BYTES(size);
39 host_ui->xattr_names -= fname_len(nm);
40 host_ui->flags &= ~UBIFS_CRYPT_FL;
42 mutex_unlock(&host_ui->ui_mutex);
44 make_bad_inode(inode);
45 @@ -241,12 +234,6 @@ static int change_xattr(struct ubifs_inf
46 mutex_unlock(&ui->ui_mutex);
48 mutex_lock(&host_ui->ui_mutex);
50 - if (!host->i_nlink) {
55 host->i_ctime = current_time(host);
56 host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
57 host_ui->xattr_size += CALC_XATTR_BYTES(size);
58 @@ -268,7 +255,6 @@ static int change_xattr(struct ubifs_inf
60 host_ui->xattr_size -= CALC_XATTR_BYTES(size);
61 host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
63 mutex_unlock(&host_ui->ui_mutex);
64 make_bad_inode(inode);
66 @@ -497,12 +483,6 @@ static int remove_xattr(struct ubifs_inf
69 mutex_lock(&host_ui->ui_mutex);
71 - if (!host->i_nlink) {
76 host->i_ctime = current_time(host);
77 host_ui->xattr_cnt -= 1;
78 host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
79 @@ -522,7 +502,6 @@ out_cancel:
80 host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
81 host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
82 host_ui->xattr_names += fname_len(nm);
84 mutex_unlock(&host_ui->ui_mutex);
85 ubifs_release_budget(c, &req);
86 make_bad_inode(inode);
87 @@ -562,9 +541,6 @@ static int ubifs_xattr_remove(struct ino
89 ubifs_assert(inode_is_locked(host));
94 if (fname_len(&nm) > UBIFS_MAX_NLEN)