Commit c37dba6a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fixes_for_v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull fs fixes from Jan Kara:
 "Three fixes that I'd still like to get to 5.18:

   - add a missing sanity check in the fanotify FAN_RENAME feature
     (added in 5.17, let's fix it before it gets wider usage in
     userspace)

   - udf fix for recently introduced filesystem corruption issue

   - writeback fix for a race in inode list handling that can lead to
     delayed writeback and possible dirty throttling stalls"

* tag 'fixes_for_v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: Avoid using stale lengthOfImpUse
  writeback: Avoid skipping inode writeback
  fanotify: do not allow setting dirent events in mask of non-dir
parents feb9c5e1 c1ad35dd
...@@ -1712,6 +1712,10 @@ static int writeback_single_inode(struct inode *inode, ...@@ -1712,6 +1712,10 @@ static int writeback_single_inode(struct inode *inode,
*/ */
if (!(inode->i_state & I_DIRTY_ALL)) if (!(inode->i_state & I_DIRTY_ALL))
inode_cgwb_move_to_attached(inode, wb); inode_cgwb_move_to_attached(inode, wb);
else if (!(inode->i_state & I_SYNC_QUEUED) &&
(inode->i_state & I_DIRTY))
redirty_tail_locked(inode, wb);
spin_unlock(&wb->list_lock); spin_unlock(&wb->list_lock);
inode_sync_complete(inode); inode_sync_complete(inode);
out: out:
......
...@@ -1657,6 +1657,19 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, ...@@ -1657,6 +1657,19 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
else else
mnt = path.mnt; mnt = path.mnt;
/*
* FAN_RENAME is not allowed on non-dir (for now).
* We shouldn't have allowed setting any dirent events in mask of
* non-dir, but because we always allowed it, error only if group
* was initialized with the new flag FAN_REPORT_TARGET_FID.
*/
ret = -ENOTDIR;
if (inode && !S_ISDIR(inode->i_mode) &&
((mask & FAN_RENAME) ||
((mask & FANOTIFY_DIRENT_EVENTS) &&
FAN_GROUP_FLAG(group, FAN_REPORT_TARGET_FID))))
goto path_put_and_out;
/* Mask out FAN_EVENT_ON_CHILD flag for sb/mount/non-dir marks */ /* Mask out FAN_EVENT_ON_CHILD flag for sb/mount/non-dir marks */
if (mnt || !S_ISDIR(inode->i_mode)) { if (mnt || !S_ISDIR(inode->i_mode)) {
mask &= ~FAN_EVENT_ON_CHILD; mask &= ~FAN_EVENT_ON_CHILD;
......
...@@ -75,11 +75,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi, ...@@ -75,11 +75,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
if (fileident) { if (fileident) {
if (adinicb || (offset + lfi < 0)) { if (adinicb || (offset + lfi < 0)) {
memcpy(udf_get_fi_ident(sfi), fileident, lfi); memcpy(sfi->impUse + liu, fileident, lfi);
} else if (offset >= 0) { } else if (offset >= 0) {
memcpy(fibh->ebh->b_data + offset, fileident, lfi); memcpy(fibh->ebh->b_data + offset, fileident, lfi);
} else { } else {
memcpy(udf_get_fi_ident(sfi), fileident, -offset); memcpy(sfi->impUse + liu, fileident, -offset);
memcpy(fibh->ebh->b_data, fileident - offset, memcpy(fibh->ebh->b_data, fileident - offset,
lfi + offset); lfi + offset);
} }
...@@ -88,11 +88,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi, ...@@ -88,11 +88,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
offset += lfi; offset += lfi;
if (adinicb || (offset + padlen < 0)) { if (adinicb || (offset + padlen < 0)) {
memset(udf_get_fi_ident(sfi) + lfi, 0x00, padlen); memset(sfi->impUse + liu + lfi, 0x00, padlen);
} else if (offset >= 0) { } else if (offset >= 0) {
memset(fibh->ebh->b_data + offset, 0x00, padlen); memset(fibh->ebh->b_data + offset, 0x00, padlen);
} else { } else {
memset(udf_get_fi_ident(sfi) + lfi, 0x00, -offset); memset(sfi->impUse + liu + lfi, 0x00, -offset);
memset(fibh->ebh->b_data, 0x00, padlen + offset); memset(fibh->ebh->b_data, 0x00, padlen + offset);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment