Skip to content

Commit 1d7e23f

Browse files
richardweinbergergregkh
authored andcommitted
Revert "ubifs: xattr: Don't operate on deleted inodes"
commit f061c1c upstream. This reverts commit 11a6fc3. 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: <[email protected]> Fixes: 11a6fc3 ("ubifs: xattr: Don't operate on deleted inodes") Reported-by: Koen Vandeputte <[email protected]> Tested-by: Joel Stanley <[email protected]> Signed-off-by: Richard Weinberger <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4438313 commit 1d7e23f

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

fs/ubifs/xattr.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
152152
ui->data_len = size;
153153

154154
mutex_lock(&host_ui->ui_mutex);
155-
156-
if (!host->i_nlink) {
157-
err = -ENOENT;
158-
goto out_noent;
159-
}
160-
161155
host->i_ctime = current_time(host);
162156
host_ui->xattr_cnt += 1;
163157
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
@@ -189,7 +183,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
189183
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
190184
host_ui->xattr_names -= fname_len(nm);
191185
host_ui->flags &= ~UBIFS_CRYPT_FL;
192-
out_noent:
193186
mutex_unlock(&host_ui->ui_mutex);
194187
out_free:
195188
make_bad_inode(inode);
@@ -241,12 +234,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
241234
mutex_unlock(&ui->ui_mutex);
242235

243236
mutex_lock(&host_ui->ui_mutex);
244-
245-
if (!host->i_nlink) {
246-
err = -ENOENT;
247-
goto out_noent;
248-
}
249-
250237
host->i_ctime = current_time(host);
251238
host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
252239
host_ui->xattr_size += CALC_XATTR_BYTES(size);
@@ -268,7 +255,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
268255
out_cancel:
269256
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
270257
host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
271-
out_noent:
272258
mutex_unlock(&host_ui->ui_mutex);
273259
make_bad_inode(inode);
274260
out_free:
@@ -497,12 +483,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
497483
return err;
498484

499485
mutex_lock(&host_ui->ui_mutex);
500-
501-
if (!host->i_nlink) {
502-
err = -ENOENT;
503-
goto out_noent;
504-
}
505-
506486
host->i_ctime = current_time(host);
507487
host_ui->xattr_cnt -= 1;
508488
host_ui->xattr_size -= CALC_DENT_SIZE(fname_len(nm));
@@ -522,7 +502,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
522502
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
523503
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
524504
host_ui->xattr_names += fname_len(nm);
525-
out_noent:
526505
mutex_unlock(&host_ui->ui_mutex);
527506
ubifs_release_budget(c, &req);
528507
make_bad_inode(inode);
@@ -562,9 +541,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
562541

563542
ubifs_assert(inode_is_locked(host));
564543

565-
if (!host->i_nlink)
566-
return -ENOENT;
567-
568544
if (fname_len(&nm) > UBIFS_MAX_NLEN)
569545
return -ENAMETOOLONG;
570546

0 commit comments

Comments
 (0)