Skip to content

Commit 8234532

Browse files
Christoph Hellwigdjwong
authored andcommitted
xfs: remove XFS_IOC_FSSETDM and XFS_IOC_FSSETDM_BY_HANDLE
Thes ioctls set DMAPI specific flags in the on-disk inode, but there is no way to actually ever query those flags. The only known user is xfsrestore with the -D option, which is documented to be only useful inside a DMAPI enviroment, which isn't supported by upstream XFS. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent eb0d216 commit 8234532

File tree

4 files changed

+0
-149
lines changed

4 files changed

+0
-149
lines changed

fs/xfs/xfs_ioctl.c

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -292,82 +292,6 @@ xfs_readlink_by_handle(
292292
return error;
293293
}
294294

295-
int
296-
xfs_set_dmattrs(
297-
xfs_inode_t *ip,
298-
uint evmask,
299-
uint16_t state)
300-
{
301-
xfs_mount_t *mp = ip->i_mount;
302-
xfs_trans_t *tp;
303-
int error;
304-
305-
if (!capable(CAP_SYS_ADMIN))
306-
return -EPERM;
307-
308-
if (XFS_FORCED_SHUTDOWN(mp))
309-
return -EIO;
310-
311-
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 0, 0, 0, &tp);
312-
if (error)
313-
return error;
314-
315-
xfs_ilock(ip, XFS_ILOCK_EXCL);
316-
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
317-
318-
ip->i_d.di_dmevmask = evmask;
319-
ip->i_d.di_dmstate = state;
320-
321-
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
322-
error = xfs_trans_commit(tp);
323-
324-
return error;
325-
}
326-
327-
STATIC int
328-
xfs_fssetdm_by_handle(
329-
struct file *parfilp,
330-
void __user *arg)
331-
{
332-
int error;
333-
struct fsdmidata fsd;
334-
xfs_fsop_setdm_handlereq_t dmhreq;
335-
struct dentry *dentry;
336-
337-
if (!capable(CAP_MKNOD))
338-
return -EPERM;
339-
if (copy_from_user(&dmhreq, arg, sizeof(xfs_fsop_setdm_handlereq_t)))
340-
return -EFAULT;
341-
342-
error = mnt_want_write_file(parfilp);
343-
if (error)
344-
return error;
345-
346-
dentry = xfs_handlereq_to_dentry(parfilp, &dmhreq.hreq);
347-
if (IS_ERR(dentry)) {
348-
mnt_drop_write_file(parfilp);
349-
return PTR_ERR(dentry);
350-
}
351-
352-
if (IS_IMMUTABLE(d_inode(dentry)) || IS_APPEND(d_inode(dentry))) {
353-
error = -EPERM;
354-
goto out;
355-
}
356-
357-
if (copy_from_user(&fsd, dmhreq.data, sizeof(fsd))) {
358-
error = -EFAULT;
359-
goto out;
360-
}
361-
362-
error = xfs_set_dmattrs(XFS_I(d_inode(dentry)), fsd.fsd_dmevmask,
363-
fsd.fsd_dmstate);
364-
365-
out:
366-
mnt_drop_write_file(parfilp);
367-
dput(dentry);
368-
return error;
369-
}
370-
371295
STATIC int
372296
xfs_attrlist_by_handle(
373297
struct file *parfilp,
@@ -2128,22 +2052,6 @@ xfs_file_ioctl(
21282052
case XFS_IOC_SETXFLAGS:
21292053
return xfs_ioc_setxflags(ip, filp, arg);
21302054

2131-
case XFS_IOC_FSSETDM: {
2132-
struct fsdmidata dmi;
2133-
2134-
if (copy_from_user(&dmi, arg, sizeof(dmi)))
2135-
return -EFAULT;
2136-
2137-
error = mnt_want_write_file(filp);
2138-
if (error)
2139-
return error;
2140-
2141-
error = xfs_set_dmattrs(ip, dmi.fsd_dmevmask,
2142-
dmi.fsd_dmstate);
2143-
mnt_drop_write_file(filp);
2144-
return error;
2145-
}
2146-
21472055
case XFS_IOC_GETBMAP:
21482056
case XFS_IOC_GETBMAPA:
21492057
case XFS_IOC_GETBMAPX:
@@ -2171,8 +2079,6 @@ xfs_file_ioctl(
21712079
return -EFAULT;
21722080
return xfs_open_by_handle(filp, &hreq);
21732081
}
2174-
case XFS_IOC_FSSETDM_BY_HANDLE:
2175-
return xfs_fssetdm_by_handle(filp, arg);
21762082

21772083
case XFS_IOC_READLINK_BY_HANDLE: {
21782084
xfs_fsop_handlereq_t hreq;

fs/xfs/xfs_ioctl.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ xfs_file_compat_ioctl(
7070
unsigned int cmd,
7171
unsigned long arg);
7272

73-
extern int
74-
xfs_set_dmattrs(
75-
struct xfs_inode *ip,
76-
uint evmask,
77-
uint16_t state);
78-
7973
struct xfs_ibulk;
8074
struct xfs_bstat;
8175
struct xfs_inogrp;

fs/xfs/xfs_ioctl32.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -500,44 +500,6 @@ xfs_compat_attrmulti_by_handle(
500500
return error;
501501
}
502502

503-
STATIC int
504-
xfs_compat_fssetdm_by_handle(
505-
struct file *parfilp,
506-
void __user *arg)
507-
{
508-
int error;
509-
struct fsdmidata fsd;
510-
compat_xfs_fsop_setdm_handlereq_t dmhreq;
511-
struct dentry *dentry;
512-
513-
if (!capable(CAP_MKNOD))
514-
return -EPERM;
515-
if (copy_from_user(&dmhreq, arg,
516-
sizeof(compat_xfs_fsop_setdm_handlereq_t)))
517-
return -EFAULT;
518-
519-
dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq);
520-
if (IS_ERR(dentry))
521-
return PTR_ERR(dentry);
522-
523-
if (IS_IMMUTABLE(d_inode(dentry)) || IS_APPEND(d_inode(dentry))) {
524-
error = -EPERM;
525-
goto out;
526-
}
527-
528-
if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) {
529-
error = -EFAULT;
530-
goto out;
531-
}
532-
533-
error = xfs_set_dmattrs(XFS_I(d_inode(dentry)), fsd.fsd_dmevmask,
534-
fsd.fsd_dmstate);
535-
536-
out:
537-
dput(dentry);
538-
return error;
539-
}
540-
541503
long
542504
xfs_file_compat_ioctl(
543505
struct file *filp,
@@ -646,8 +608,6 @@ xfs_file_compat_ioctl(
646608
return xfs_compat_attrlist_by_handle(filp, arg);
647609
case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
648610
return xfs_compat_attrmulti_by_handle(filp, arg);
649-
case XFS_IOC_FSSETDM_BY_HANDLE_32:
650-
return xfs_compat_fssetdm_by_handle(filp, arg);
651611
default:
652612
/* try the native version */
653613
return xfs_file_ioctl(filp, cmd, (unsigned long)arg);

fs/xfs/xfs_ioctl32.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,6 @@ typedef struct compat_xfs_fsop_attrmulti_handlereq {
143143
#define XFS_IOC_ATTRMULTI_BY_HANDLE_32 \
144144
_IOW('X', 123, struct compat_xfs_fsop_attrmulti_handlereq)
145145

146-
typedef struct compat_xfs_fsop_setdm_handlereq {
147-
struct compat_xfs_fsop_handlereq hreq; /* handle information */
148-
/* ptr to struct fsdmidata */
149-
compat_uptr_t data; /* DMAPI data */
150-
} compat_xfs_fsop_setdm_handlereq_t;
151-
152-
#define XFS_IOC_FSSETDM_BY_HANDLE_32 \
153-
_IOW('X', 121, struct compat_xfs_fsop_setdm_handlereq)
154-
155146
#ifdef BROKEN_X86_ALIGNMENT
156147
/* on ia32 l_start is on a 32-bit boundary */
157148
typedef struct compat_xfs_flock64 {

0 commit comments

Comments
 (0)