Re: [PATCH v7.3 9/9] cifs: Add support for creating WSL symlinks in version 1 format
From: Namjae Jeon
Date: Mon Oct 26 2026 - 21:38:58 EST
> @@ -708,7 +716,7 @@ static int wsl_set_xattrs(struct inode *inode, umode_t _mode,
> static int mknod_wsl(unsigned int xid, struct inode *inode,
> struct dentry *dentry, struct cifs_tcon *tcon,
> const char *full_path, umode_t mode, dev_t dev,
> - const char *symname)
> + const char *symname, int symver)
> {
> struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
> struct cifs_open_info_data data;
> @@ -717,6 +725,12 @@ static int mknod_wsl(unsigned int xid, struct inode *inode,
> struct inode *new;
> unsigned int len;
> struct kvec reparse_iov, xattr_iov;
> + struct cifs_open_parms oparms;
> + struct cifs_io_parms io_parms;
> + unsigned int bytes_written;
> + struct kvec symv1_iov[2];
> + struct cifs_fid fid;
> + __u32 oplock;
> int rc;
>
> /*
> @@ -726,7 +740,7 @@ static int mknod_wsl(unsigned int xid, struct inode *inode,
> if (!(le32_to_cpu(tcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_EXTENDED_ATTRIBUTES))
> return -EOPNOTSUPP;
>
> - rc = wsl_set_reparse_buf(&buf, mode, symname, cifs_sb, &reparse_iov);
> + rc = wsl_set_reparse_buf(&buf, mode, symname, symver, cifs_sb, &reparse_iov);
> if (rc)
> return rc;
>
> @@ -751,6 +765,45 @@ static int mknod_wsl(unsigned int xid, struct inode *inode,
> &data, inode->i_sb,
> xid, tcon, full_path, false,
> &reparse_iov, &xattr_iov);
> + if (!IS_ERR(new) && mode == S_IFLNK && symver == 1) {
> + /*
> + * WSL symlink layout version 1 stores the symlink target
> + * location into the data section of the file.
> + * Store it now after the reparse point file was created.
> + * The target location was allocated into the buf but iov
> + * size filled in reparse_iov by wsl_set_reparse_buf() was
> + * set to smaller so the created reparse point does not
> + * contain it.
> + */
> + oparms = CIFS_OPARMS(cifs_sb, tcon, full_path, FILE_WRITE_DATA,
> + FILE_OPEN, CREATE_NOT_DIR | OPEN_REPARSE_POINT,
> + ACL_NO_MODE);
> + oparms.fid = &fid;
It is the same here. we need to initialize fid and call new_lease_key().
> + oplock = tcon->ses->server->oplocks ? REQ_OPLOCK : 0;
> + rc = tcon->ses->server->ops->open(xid, &oparms, &oplock, NULL);