Fix FIFO and socket handling

Under Linux when creating a fifo or socket type device in the ZFS
filesystem it's critical that the rdev is stored in a SA.  This
was already being correctly done for character and block devices,
but that logic needed to be extended to include FIFOs and sockets.

This patch takes care of device creation but a follow on patch
may still be required to verify that the dev_t is being correctly
packed/unpacked from the SA.
This commit is contained in:
Brian Behlendorf 2011-02-16 09:51:44 -08:00
parent d567444809
commit d8fd10545b

View File

@ -586,7 +586,8 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
size = links = 0;
}
if (S_ISBLK(vap->va_mode) || S_ISCHR(vap->va_mode))
if (S_ISBLK(vap->va_mode) || S_ISCHR(vap->va_mode) ||
S_ISFIFO(vap->va_mode) || S_ISSOCK(vap->va_mode))
rdev = zfs_expldev(vap->va_rdev);
parent = dzp->z_id;
@ -677,10 +678,10 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr,
&empty_xattr, 8);
}
if (obj_type == DMU_OT_ZNODE ||
(S_ISBLK(vap->va_mode) || S_ISCHR(vap->va_mode))) {
(S_ISBLK(vap->va_mode) || S_ISCHR(vap->va_mode) ||
S_ISFIFO(vap->va_mode) || S_ISSOCK(vap->va_mode))) {
SA_ADD_BULK_ATTR(sa_attrs, cnt, SA_ZPL_RDEV(zsb),
NULL, &rdev, 8);
}
if (obj_type == DMU_OT_ZNODE) {
SA_ADD_BULK_ATTR(sa_attrs, cnt, SA_ZPL_FLAGS(zsb),