Commit c37dba6a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1712,6 +1712,10 @@ static int writeback_single_inode(struct inode *inode,
	 */
	if (!(inode->i_state & I_DIRTY_ALL))
		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);
	inode_sync_complete(inode);
out:
+13 −0
Original line number Diff line number Diff line
@@ -1657,6 +1657,19 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
	else
		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 */
	if (mnt || !S_ISDIR(inode->i_mode)) {
		mask &= ~FAN_EVENT_ON_CHILD;
+4 −4
Original line number Diff line number Diff line
@@ -75,11 +75,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,

	if (fileident) {
		if (adinicb || (offset + lfi < 0)) {
			memcpy(udf_get_fi_ident(sfi), fileident, lfi);
			memcpy(sfi->impUse + liu, fileident, lfi);
		} else if (offset >= 0) {
			memcpy(fibh->ebh->b_data + offset, fileident, lfi);
		} else {
			memcpy(udf_get_fi_ident(sfi), fileident, -offset);
			memcpy(sfi->impUse + liu, fileident, -offset);
			memcpy(fibh->ebh->b_data, fileident - offset,
				lfi + offset);
		}
@@ -88,11 +88,11 @@ int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
	offset += lfi;

	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) {
		memset(fibh->ebh->b_data + offset, 0x00, padlen);
	} 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);
	}