Skip to content

Commit

Permalink
OS-3893 sendfile compat checks shouldn't be done in so_sendmblk
Browse files Browse the repository at this point in the history
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information
rmustacc committed Feb 23, 2015
1 parent 967de64 commit b628476
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
5 changes: 0 additions & 5 deletions usr/src/uts/common/fs/sockfs/sockcommon_sops.c
Expand Up @@ -586,11 +586,6 @@ so_sendmblk(struct sonode *so, struct nmsghdr *msg, int fflag,

SO_BLOCK_FALLBACK(so, SOP_SENDMBLK(so, msg, fflag, cr, mpp));

if ((so->so_mode & SM_SENDFILESUPP) == 0) {
SO_UNBLOCK_FALLBACK(so);
return (EOPNOTSUPP);
}

error = so_sendmblk_impl(so, msg, fflag, cr, mpp, so->so_filter_top,
B_FALSE);

Expand Down
19 changes: 15 additions & 4 deletions usr/src/uts/common/syscall/sendfile.c
Expand Up @@ -82,7 +82,7 @@ extern sotpi_info_t *sotpi_sototpi(struct sonode *);
* 64 bit kernel or 32 bit kernel. For 32 bit apps, we can't transfer
* more than 2GB of data.
*/
int
static int
sendvec_chunk64(file_t *fp, u_offset_t *fileoff, struct ksendfilevec64 *sfv,
int copy_cnt, ssize32_t *count)
{
Expand Down Expand Up @@ -343,7 +343,7 @@ sendvec_chunk64(file_t *fp, u_offset_t *fileoff, struct ksendfilevec64 *sfv,
return (0);
}

ssize32_t
static ssize32_t
sendvec64(file_t *fp, const struct ksendfilevec64 *vec, int sfvcnt,
size32_t *xferred, int fildes)
{
Expand Down Expand Up @@ -390,7 +390,7 @@ sendvec64(file_t *fp, const struct ksendfilevec64 *vec, int sfvcnt,
}
#endif

int
static int
sendvec_small_chunk(file_t *fp, u_offset_t *fileoff, struct sendfilevec *sfv,
int copy_cnt, ssize_t total_size, int maxblk, ssize_t *count)
{
Expand Down Expand Up @@ -680,7 +680,7 @@ sendvec_small_chunk(file_t *fp, u_offset_t *fileoff, struct sendfilevec *sfv,
}


int
static int
sendvec_chunk(file_t *fp, u_offset_t *fileoff, struct sendfilevec *sfv,
int copy_cnt, ssize_t *count)
{
Expand Down Expand Up @@ -1160,6 +1160,17 @@ sendfilev(int opcode, int fildes, const struct sendfilevec *vec, int sfvcnt,
} else {
maxblk = (int)vp->v_stream->sd_maxblk;
}

/*
* We need to make sure that the socket that we're sending on
* supports sendfile behavior. sockfs doesn't know that the APIs
* we want to use are coming from sendfile, so we can't rely on
* it to check for us.
*/
if ((so->so_mode & SM_SENDFILESUPP) == 0) {
error = EOPNOTSUPP;
goto err;
}
break;
case VREG:
break;
Expand Down

0 comments on commit b628476

Please sign in to comment.