Skip to content

Commit f061c1c

Browse files
Revert "ubifs: xattr: Don't operate on deleted inodes"
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]>
1 parent d3bdc01 commit f061c1c

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));
@@ -190,7 +184,6 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
190184
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
191185
host_ui->xattr_names -= fname_len(nm);
192186
host_ui->flags &= ~UBIFS_CRYPT_FL;
193-
out_noent:
194187
mutex_unlock(&host_ui->ui_mutex);
195188
out_free:
196189
make_bad_inode(inode);
@@ -242,12 +235,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
242235
mutex_unlock(&ui->ui_mutex);
243236

244237
mutex_lock(&host_ui->ui_mutex);
245-
246-
if (!host->i_nlink) {
247-
err = -ENOENT;
248-
goto out_noent;
249-
}
250-
251238
host->i_ctime = current_time(host);
252239
host_ui->xattr_size -= CALC_XATTR_BYTES(old_size);
253240
host_ui->xattr_size += CALC_XATTR_BYTES(size);
@@ -269,7 +256,6 @@ static int change_xattr(struct ubifs_info *c, struct inode *host,
269256
out_cancel:
270257
host_ui->xattr_size -= CALC_XATTR_BYTES(size);
271258
host_ui->xattr_size += CALC_XATTR_BYTES(old_size);
272-
out_noent:
273259
mutex_unlock(&host_ui->ui_mutex);
274260
make_bad_inode(inode);
275261
out_free:
@@ -496,12 +482,6 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
496482
return err;
497483

498484
mutex_lock(&host_ui->ui_mutex);
499-
500-
if (!host->i_nlink) {
501-
err = -ENOENT;
502-
goto out_noent;
503-
}
504-
505485
host->i_ctime = current_time(host);
506486
host_ui->xattr_cnt -= 1;
507487
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,
521501
host_ui->xattr_size += CALC_DENT_SIZE(fname_len(nm));
522502
host_ui->xattr_size += CALC_XATTR_BYTES(ui->data_len);
523503
host_ui->xattr_names += fname_len(nm);
524-
out_noent:
525504
mutex_unlock(&host_ui->ui_mutex);
526505
ubifs_release_budget(c, &req);
527506
make_bad_inode(inode);
@@ -561,9 +540,6 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
561540

562541
ubifs_assert(c, inode_is_locked(host));
563542

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

0 commit comments

Comments
 (0)