Re: [PATCH] Add support for getting and setting SACLs

2020-12-07 Thread Pavel Shilovsky
linux-cifs mailing list. I stage pending patches in the "next" branch on my github tree, so, will include the one above. https://github.com/piastry/cifs-utils/commits/next -- Best regards, Pavel Shilovsky пн, 7 дек. 2020 г. в 07:28, Boris Protopopov : > > Hello, Shyam, > >

Re: [PATCH AUTOSEL 5.7 37/53] cifs: Fix double add page to memcg when cifs_readpages

2020-07-02 Thread Pavel Shilovsky
iaoxu > Signed-off-by: Steve French > Acked-by: Ronnie Sahlberg > Signed-off-by: Sasha Levin Hi Sasha, The patch description mentions the commit 3fea5a499d57 that changed the behavior and was introduced in v5.8-rc1. I noticed that you are targeting this patch for 4.9, 4.14, 4.19, 5.4 and 5.7 stable branches. Are you going to backport the commit 3fea5a499d57 as well? -- Best regards, Pavel Shilovsky

Re: [PATCH] cifs: Fix missed free operations

2019-10-14 Thread Pavel Shilovsky
if (rc) > - return rc; > + goto cifs_setattr_exit; > } else if (rc != -EBADF) > - return rc; > + goto cifs_setattr_exit; > else >

Re: build_path_from_dentry_optional_prefix() may schedule from invalid context

2019-09-30 Thread Pavel Shilovsky
сб, 21 сент. 2019 г. в 15:38, Al Viro : > > On Thu, Sep 19, 2019 at 05:11:54PM -0700, Pavel Shilovsky wrote: > > > Good catch. I think we should have another version of > > build_path_from_dentry() which takes pre-allocated (probably on stack) > > full_path as an argum

Re: build_path_from_dentry_optional_prefix() may schedule from invalid context

2019-09-19 Thread Pavel Shilovsky
t; >spin_unlock(&tcon->open_file_lock); > > Additionally, kfree() can (and should) be done outside of > ->open_file_lock scope. > > -ss Good catch. I think we should have another version of build_path_from_dentry() which takes pre-allocated (probably on stack) full_path as an argument. This would allow us to avoid allocations under the spin lock. -- Best regards, Pavel Shilovsky

Re: [PATCH 2/2] cifs: Allocate memory for all iovs in smb2_ioctl

2019-05-15 Thread Pavel Shilovsky
t *rqst, > void > SMB2_ioctl_free(struct smb_rqst *rqst) > { > - if (rqst && rqst->rq_iov) > + if (rqst && rqst->rq_iov) { > cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request > */ > + if (rqst->rq_iov[1].iov_len) > + kfree(rqst->rq_iov[1].iov_base); > + } > } > > > -- > 2.17.1 > Looks correct. Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH 2/2] cifs:smbd Use the correct DMA direction when sending data

2019-05-14 Thread Pavel Shilovsky
0,10 @@ int smbd_send(struct TCP_Server_Info *server, > goto done; > } > > - rqst_idx = 0; > + log_write(INFO, "num_rqst=%d total length=%u\n", > + num_rqst, remaining_data_length); > > + rqst_idx = 0; > next_rqst: > rqst = &rqst_array[rqst_idx]; > iov = rqst->rq_iov; > -- > 2.17.1 > Acked-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH 1/2] cifs:smbd When reconnecting to server, call smbd_destroy() after all MIDs have been called

2019-05-14 Thread Pavel Shilovsky
rver->ssocket = NULL; > - } else if (cifs_rdma_enabled(server)) > + if (cifs_rdma_enabled(server)) { > + mutex_lock(&server->srv_mutex); > smbd_destroy(server); > - server->sequence_number = 0; > - server->sess

Re: [Patch (resend) 5/5] cifs: Call MID callback before destroying transport

2019-05-09 Thread Pavel Shilovsky
er* callbacks, let's just move it alone without the rest of the code. > + server->sequence_number = 0; > + server->session_estab = false; > + kfree(server->session_key.response); > + server->session_key.response = NULL; > + server->session_key.len = 0; > + server->lstrp = jiffies; > + > + mutex_unlock(&server->srv_mutex); > + > do { > try_to_freeze(); > > -- > 2.7.4 > -- Best regards, Pavel Shilovsky

Re: [PATCH v2] cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()

2019-05-08 Thread Pavel Shilovsky
ср, 8 мая 2019 г. в 01:23, Kai-Heng Feng : > > at 02:28, Pavel Shilovsky wrote: > > > вт, 7 мая 2019 г. в 09:13, Steve French via samba-technical > > : > >> merged into cifs-2.6.git for-next > >> > >> On Tue, May 7, 2019 at 10:17 AM Christoph Prob

Re: [PATCH v2] cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()

2019-05-07 Thread Pavel Shilovsky
new_oplock |= CIFS_CACHE_WRITE_FLG; > > strcat(message, "W"); > > } > > - if (!cinode->oplock) > > - strcat(message, "None"); > > + if (!new_oplock) > > + strncpy(message, "None", sizeof(message)); > > + > > + cinode->oplock = new_oplock; > > cifs_dbg(FYI, "%s Lease granted on inode %p\n", message, > > &cinode->vfs_inode); > > } > > -- > > 2.1.4 > > > > > Thanks for cleaning it up! Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH] cifs: fix strcat buffer overflow in smb21_set_oplock_level()

2019-05-06 Thread Pavel Shilovsky
The patch itself is fine but I think we have a bigger problem here: 3052 >---cinode->oplock = 0; here we reset oplock level of the inode, so forcing all the IO go to the server. 3053 >---if (oplock & SMB2_LEASE_READ_CACHING_HE) { 3054 >--->---cinode->oplock |= CIFS_CACHE_READ_FLG

Re: [PATCH] cifs: fix page reference leak with readv/writev

2019-04-18 Thread Pavel Shilovsky
> > > return NULL; > > > @@ -786,7 +791,23 @@ cifs_aio_ctx_release(struct kref *refcount) > > > struct cifs_aio_ctx, refcount); > > > > > > cifsFileInfo_put(ctx->cfile); > > > - kvfree(ctx->bv); > > > + > > > + /* > > > +* ctx->bv is only set if setup_aio_ctx_iter() was call > > > successfuly > > > +* which means that iov_iter_get_pages() was a success and thus > > > that > > > +* we have taken reference on pages. > > > +*/ > > > + if (ctx->bv) { > > > + unsigned i; > > > + > > > + for (i = 0; i < ctx->npages; i++) { > > > + if (ctx->should_dirty) > > > + set_page_dirty(ctx->bv[i].bv_page); > > > + put_page(ctx->bv[i].bv_page); > > > + } > > > + kvfree(ctx->bv); > > > + } > > > + > > > kfree(ctx); > > > } > > > > > > -- > > > 2.20.1 > > > Good catch, thanks! Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH] secdesc-ui.py: a UI to view the security descriptors on SMB2+ shares

2019-04-01 Thread Pavel Shilovsky
This is really cool! Thanks Ronnie. I will be targeting this for the next release of cifs-utils (not the one that I am about to cut off), so we will have time to stabilize it. Best regards, Pavel Shilovsky вс, 31 мар. 2019 г. в 21:51, Steve French via samba-technical : > > The tool that

Re: [Patch v2 2/2] CIFS: Fix an issue with re-sending rdata when transport returning -EAGAIN

2019-03-16 Thread Pavel Shilovsky
return 0; > + } > > - add_credits_and_wake_if(server, &rdata->credits, 0); > -out: > - kref_put(&rdata->refcount, > - cifs_uncached_readdata_release); > + /* Roll back credits and retry if needed */ > + add_credits_and_wake_if(server, &rdata->credits, 0); > + } while (rc == -EAGAIN); > > +fail: > + kref_put(&rdata->refcount, cifs_uncached_readdata_release); > return rc; > } > > -- > 2.14.1 > Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [Patch v2 1/2] CIFS: Fix an issue with re-sending wdata when transport returning -EAGAIN

2019-03-16 Thread Pavel Shilovsky
p_list, > ctx); > + > + kref_put(&wdata->refcount, > + > cifs_uncached_writedata_release); > } > > list_splice(&tmp_list, &ctx->list); > - > - kref_put(&wdata->refcount, > -cifs_uncached_writedata_release); > goto restart_loop; > } > } > -- > 2.14.1 > Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH 1/2] CIFS: Fix a bug with re-sending wdata when transport returning -EAGAIN

2019-03-05 Thread Pavel Shilovsky
mp;wdata->refcount, > + > cifs_uncached_writedata_release); > } > > list_splice(&tmp_list, &ctx->list); > - > - kref_put(&wdata->refcount, > -cifs_uncached_writedata_release); > goto restart_loop; > } > } > -- > 2.17.1 > The similar concepts applies for async reads as well. -- Best regards, Pavel Shilovsky

Re: [PATCH AUTOSEL 4.20 65/77] CIFS: Do not assume one credit for async responses

2019-02-27 Thread Pavel Shilovsky
ср, 27 февр. 2019 г. в 09:54, Sasha Levin : > > On Fri, Feb 15, 2019 at 08:10:47PM +, Pavel Shilovskiy wrote: > >чт, 14 февр. 2019 г. в 18:40, Sasha Levin : > >> > >> From: Pavel Shilovsky > >> > >> [ Upstream commit 0fd1d37b0501efc6e295f56ab5

Re: [PATCH] CIFS: Avoid returning EBUSY to upper layer VFS

2018-12-06 Thread Pavel Shilovsky
ke_if(server, credits, 0); > > msleep(1000); > > - wait_retry++; > > } > > - } while (rsize < rdata->bytes && wait_retry < 3); > > - > > - /* > > -* If we can't find enough credits to send this rdata > > -* release the rdata and return failure, this will pass > > -* whatever I/O amount we have finished to VFS. > > -*/ > > - if (rsize < rdata->bytes) { > > - rc = -EBUSY; > > - goto out; > > - } > > + } while (rsize < rdata->bytes); > > > > rc = -EAGAIN; > > while (rc == -EAGAIN) { > > -- > > 2.7.4 > > > > > -- > Thanks, > > Steve > Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [Patch v4 1/3] CIFS: Add support for direct I/O read

2018-11-29 Thread Pavel Shilovsky
> > > > - } > > > > > + if (!ctx->direct_io) { > > > > > + for (i = 0; i < ctx->npages; i++) { > > > > > + if (ctx->should_dirty) > > > > > + set_page_dirty(ctx->bv[i].bv_page); > > > > > + put_page(ctx->bv[i].bv_page); > > > > > + } > > > > > > > > > > - ctx->total_len = ctx->len - iov_iter_count(to); > > > > > + ctx->total_len = ctx->len - iov_iter_count(to); > > > > > + } > > > > > > > > > > cifs_stats_bytes_read(tcon, ctx->total_len); > > > > > > > > > > @@ -3267,18 +3383,27 @@ collect_uncached_read_data(struct > > > > cifs_aio_ctx *ctx) > > > > > complete(&ctx->done); > > > > > > > > and then ctx->rc is set to -EBUSY too. > > > > > > > > > } > > > > > > > > > > -ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to) > > > > > +ssize_t __cifs_readv(struct kiocb *iocb, struct iov_iter *to, > > > > > +bool > > > > > +direct) > > > > > { > > > > > - struct file *file = iocb->ki_filp; > > > > > - ssize_t rc; > > > > > size_t len; > > > > > - ssize_t total_read = 0; > > > > > - loff_t offset = iocb->ki_pos; > > > > > + struct file *file = iocb->ki_filp; > > > > > struct cifs_sb_info *cifs_sb; > > > > > - struct cifs_tcon *tcon; > > > > > struct cifsFileInfo *cfile; > > > > > + struct cifs_tcon *tcon; > > > > > + ssize_t rc, total_read = 0; > > > > > + loff_t offset = iocb->ki_pos; > > > > > struct cifs_aio_ctx *ctx; > > > > > > > > > > + /* > > > > > +* iov_iter_get_pages_alloc() doesn't work with ITER_KVEC, > > > > > +* fall back to data copy read path > > > > > +* this could be improved by getting pages directly in > > > > > ITER_KVEC > > > > > +*/ > > > > > + if (direct && to->type & ITER_KVEC) { > > > > > + cifs_dbg(FYI, "use non-direct cifs_user_readv for > > > > > kvec I/O\n"); > > > > > + direct = false; > > > > > + } > > > > > + > > > > > len = iov_iter_count(to); > > > > > if (!len) > > > > > return 0; > > > > > @@ -3305,14 +3430,20 @@ ssize_t cifs_user_readv(struct kiocb > > > > > *iocb, > > > > struct iov_iter *to) > > > > > if (to->type == ITER_IOVEC) > > > > > ctx->should_dirty = true; > > > > > > > > > > - rc = setup_aio_ctx_iter(ctx, to, READ); > > > > > - if (rc) { > > > > > - kref_put(&ctx->refcount, cifs_aio_ctx_release); > > > > > - return rc; > > > > > + if (direct) { > > > > > + ctx->pos = offset; > > > > > + ctx->direct_io = true; > > > > > + ctx->iter = *to; > > > > > + ctx->len = len; > > > > > + } else { > > > > > + rc = setup_aio_ctx_iter(ctx, to, READ); > > > > > + if (rc) { > > > > > + kref_put(&ctx->refcount, > > > > > cifs_aio_ctx_release); > > > > > + return rc; > > > > > + } > > > > > + len = ctx->len; > > > > > } > > > > > > > > > > - len = ctx->len; > > > > > - > > > > > /* grab a lock here due to read response handlers can access > > > > > ctx */ > > > > > mutex_lock(&ctx->aio_mutex); > > > > > > > > > > @@ -3354,6 +3485,16 @@ ssize_t cifs_user_readv(struct kiocb *iocb, > > > > struct iov_iter *to) > > > > > return rc; > > > > > > > > In case of a blocking read we will return -EBUSY to the caller but > > > > read man page doesn't say anything about a possibility to return > > > > this error code. Is it being mapped somehow by VFS or is there > > > > another consideration? The same question applies to the write patch as > > well. > > > > > > Thanks Pavel, Yes this is a bug. > > > > > > In practice, the retry logic will rarely get hit. If getting hit, > > > normally the > > server will give us far more credits for resending this whole packet. > > > > > > How about just retrying forever (instead of trying 3 times) on this resend > > packet? This will change the code to the same behavior before direct I/O > > patches. > > > > > > e.g.: > > > > > > /* > > > * Try to resend this wdata, waiting for credits before sending > > > * Note: we are attempting to resend the whole wdata not in > > segments > > > */ > > > do { > > > rc = server->ops->wait_mtu_credits( > > > server, wdata->bytes, &wsize, &credits); > > > > > > if (rc) > > > break; > > > > > > if (wsize < wdata->bytes) { > > > add_credits_and_wake_if(server, credits, 0); > > > msleep(1000); > > > } > > > } while (wsize < wdata->bytes); > > > > > > > We can do that but it won't be the same behavior because we were using a > > partial send: > > Yes it's a little different. > > I don't see any ill effects of doing this, other than we may wait for a > little longer on a full credit to send the whole packet. In practice the > server always offers a full credit on the first call to wait_mtu_credits(), I > am yet to see the while loop actually get looped. > > The resend path is rarely getting hit in stress tests on TCP, I estimate > maybe less than 0.001% on my test setup, the while loop for waiting credits > is ever harder to hit that I never see one. > > On RDMA, the resend path is never used. Ok. Another way to fix this is to break the request into several smaller ones consuming 1 credit per request - see cifs_writev_requeue() function that does the same thing for writes. -- Best regards, Pavel Shilovsky

Re: [Patch v4 1/3] CIFS: Add support for direct I/O read

2018-11-29 Thread Pavel Shilovsky
t; > > + /* > > > +* iov_iter_get_pages_alloc() doesn't work with ITER_KVEC, > > > +* fall back to data copy read path > > > +* this could be improved by getting pages directly in ITER_KVEC > > > +*/ > > > + if (direct && to->type & ITER_KVEC) { > > > + cifs_dbg(FYI, "use non-direct cifs_user_readv for kvec > > > I/O\n"); > > > + direct = false; > > > + } > > > + > > > len = iov_iter_count(to); > > > if (!len) > > > return 0; > > > @@ -3305,14 +3430,20 @@ ssize_t cifs_user_readv(struct kiocb *iocb, > > struct iov_iter *to) > > > if (to->type == ITER_IOVEC) > > > ctx->should_dirty = true; > > > > > > - rc = setup_aio_ctx_iter(ctx, to, READ); > > > - if (rc) { > > > - kref_put(&ctx->refcount, cifs_aio_ctx_release); > > > - return rc; > > > + if (direct) { > > > + ctx->pos = offset; > > > + ctx->direct_io = true; > > > + ctx->iter = *to; > > > + ctx->len = len; > > > + } else { > > > + rc = setup_aio_ctx_iter(ctx, to, READ); > > > + if (rc) { > > > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > > > + return rc; > > > + } > > > + len = ctx->len; > > > } > > > > > > - len = ctx->len; > > > - > > > /* grab a lock here due to read response handlers can access ctx > > > */ > > > mutex_lock(&ctx->aio_mutex); > > > > > > @@ -3354,6 +3485,16 @@ ssize_t cifs_user_readv(struct kiocb *iocb, > > struct iov_iter *to) > > > return rc; > > > > In case of a blocking read we will return -EBUSY to the caller but read man > > page doesn't say anything about a possibility to return this error code. Is > > it > > being mapped somehow by VFS or is there another consideration? The same > > question applies to the write patch as well. > > Thanks Pavel, Yes this is a bug. > > In practice, the retry logic will rarely get hit. If getting hit, normally > the server will give us far more credits for resending this whole packet. > > How about just retrying forever (instead of trying 3 times) on this resend > packet? This will change the code to the same behavior before direct I/O > patches. > > e.g.: > > /* > * Try to resend this wdata, waiting for credits before sending > * Note: we are attempting to resend the whole wdata not in segments > */ > do { > rc = server->ops->wait_mtu_credits( > server, wdata->bytes, &wsize, &credits); > > if (rc) > break; > > if (wsize < wdata->bytes) { > add_credits_and_wake_if(server, credits, 0); > msleep(1000); > } > } while (wsize < wdata->bytes); > We can do that but it won't be the same behavior because we were using a partial send: + if (ctx->direct_io) { + /* +* Re-use rdata as this is a +* direct I/O +*/ + rc = cifs_resend_rdata( + rdata, + &tmp_list, ctx); + } else { + rc = cifs_send_async_read( rdata->offset + got_bytes, rdata->bytes - got_bytes, rdata->cfile, cifs_sb, &tmp_list, ctx); -- Best regards, Pavel Shilovsky

Re: [Patch v4 2/3] CIFS: Add support for direct I/O write

2018-11-29 Thread Pavel Shilovsky
/* > > > -* BB - optimize the way when signing is disabled. We can drop > > > this > > > -* extra memory-to-memory copying and use iovec buffers for > > constructing > > > - * write request. > > > +* iov_iter_get_pages_alloc doesn't work with ITER_KVEC. > > > +* In this case, fall back to non-direct write function. > > > +* this could be improved by getting pages directly in > > > + ITER_KVEC > > > */ > > > + if (direct && from->type & ITER_KVEC) { > > > + cifs_dbg(FYI, "use non-direct cifs_writev for kvec > > > I/O\n"); > > > + direct = false; > > > + } > > > > > > rc = generic_write_checks(iocb, from); > > > if (rc <= 0) > > > @@ -2742,10 +2838,16 @@ ssize_t cifs_user_writev(struct kiocb *iocb, > > > struct iov_iter *from) > > > > > > ctx->pos = iocb->ki_pos; > > > > > > - rc = setup_aio_ctx_iter(ctx, from, WRITE); > > > - if (rc) { > > > - kref_put(&ctx->refcount, cifs_aio_ctx_release); > > > - return rc; > > > + if (direct) { > > > + ctx->direct_io = true; > > > + ctx->iter = *from; > > > + ctx->len = len; > > > + } else { > > > + rc = setup_aio_ctx_iter(ctx, from, WRITE); > > > + if (rc) { > > > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > > > + return rc; > > > + } > > > } > > > > > > /* grab a lock here due to read response handlers can access > > > ctx */ @@ -2795,6 +2897,16 @@ ssize_t cifs_user_writev(struct kiocb > > *iocb, struct iov_iter *from) > > > return total_written; > > > } > > > > > > +ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from) > > > +{ > > > + return __cifs_writev(iocb, from, true); } > > > + > > > +ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) { > > > + return __cifs_writev(iocb, from, false); } > > > + > > > static ssize_t > > > cifs_writev(struct kiocb *iocb, struct iov_iter *from) { > > > -- > > > 2.7.4 > > > > > > > Did you measure the performance benefit of using O_DIRECT with your > > patches for non-RDMA mode? > > Here are some of the results measured on TCP/IP over IPoIB 40G Infiniband. > Please note that IPoIB is done in software so it's slower than a 40G Ethernet > NIC. > > All servers are running 2 X Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz. Tested > on FIO 64k read or write with queue depths 1 or 16. All the tests are running > with 1 FIO job, and with "direct=1". > > Without direct I/O: > read 64k d1 113669KB/s > read 64k d16618428KB/s > write 64k d1134911KB/s > write 64k d16 457005KB/s > > With direct I/O: > read 64k d1 127134KB/s > read 64k d16714629KB/s > write 64k d1129268KB/s > write 64k d16 461054KB/s > > Direct I/O improvement: > read 64k d1 11% > read 64k d1615% > write 64k d1-5% ^^^ This is strange. Is it consistent across multiple runs? > write 64k d16 1% Good read performance improvements overall and it seems write performance results need more investigations. -- Best regards, Pavel Shilovsky

Re: [Patch v4 2/3] CIFS: Add support for direct I/O write

2018-11-16 Thread Pavel Shilovsky
> + } > > rc = generic_write_checks(iocb, from); > if (rc <= 0) > @@ -2742,10 +2838,16 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct > iov_iter *from) > > ctx->pos = iocb->ki_pos; > > - rc = setup_aio_ctx_iter(ctx, from, WRITE); > - if (rc) { > - kref_put(&ctx->refcount, cifs_aio_ctx_release); > - return rc; > + if (direct) { > + ctx->direct_io = true; > + ctx->iter = *from; > + ctx->len = len; > + } else { > + rc = setup_aio_ctx_iter(ctx, from, WRITE); > + if (rc) { > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > + return rc; > + } > } > > /* grab a lock here due to read response handlers can access ctx */ > @@ -2795,6 +2897,16 @@ ssize_t cifs_user_writev(struct kiocb *iocb, struct > iov_iter *from) > return total_written; > } > > +ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from) > +{ > + return __cifs_writev(iocb, from, true); > +} > + > +ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) > +{ > + return __cifs_writev(iocb, from, false); > +} > + > static ssize_t > cifs_writev(struct kiocb *iocb, struct iov_iter *from) > { > -- > 2.7.4 > Did you measure the performance benefit of using O_DIRECT with your patches for non-RDMA mode? -- Best regards, Pavel Shilovsky

Re: [Patch v4 1/3] CIFS: Add support for direct I/O read

2018-11-16 Thread Pavel Shilovsky
return 0; > @@ -3305,14 +3430,20 @@ ssize_t cifs_user_readv(struct kiocb *iocb, struct > iov_iter *to) > if (to->type == ITER_IOVEC) > ctx->should_dirty = true; > > - rc = setup_aio_ctx_iter(ctx, to, READ); > - if (rc) { > - kref_put(&ctx->refcount, cifs_aio_ctx_release); > - return rc; > + if (direct) { > + ctx->pos = offset; > + ctx->direct_io = true; > + ctx->iter = *to; > + ctx->len = len; > + } else { > + rc = setup_aio_ctx_iter(ctx, to, READ); > + if (rc) { > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > + return rc; > + } > + len = ctx->len; > } > > - len = ctx->len; > - > /* grab a lock here due to read response handlers can access ctx */ > mutex_lock(&ctx->aio_mutex); > > @@ -3354,6 +3485,16 @@ ssize_t cifs_user_readv(struct kiocb *iocb, struct > iov_iter *to) > return rc; In case of a blocking read we will return -EBUSY to the caller but read man page doesn't say anything about a possibility to return this error code. Is it being mapped somehow by VFS or is there another consideration? The same question applies to the write patch as well. > } > > +ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to) > +{ > + return __cifs_readv(iocb, to, true); > +} > + > +ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to) > +{ > + return __cifs_readv(iocb, to, false); > +} > + > ssize_t > cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to) > { > -- > 2.7.4 > -- Best regards, Pavel Shilovsky

Re: [PATCH] CIFS: Print message when attempting mount

2018-10-01 Thread Pavel Shilovsky
t;Devname: %s flags: %d\n", dev_name, flags); Let's change the next FYI line to not contain devname thus avoiding duplicate logging when FYI is enabled. > > volume_info = cifs_get_volume_info((char *)data, dev_name, is_smb3); > -- > 1.8.3.1 > Other than the comment above I agree with the change. -- Best regards, Pavel Shilovsky

Re: [PATCH V3 (resend) 4/7] CIFS: Add support for direct I/O write

2018-09-21 Thread Pavel Shilovsky
new rc value from that. > +*/ > + if (!list_empty(&ctx->list)) > + rc = 0; > + > + mutex_unlock(&ctx->aio_mutex); > + > + if (rc) { > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > + return rc; > + } > + > + if (!is_sync_kiocb(iocb)) { > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > + return -EIOCBQUEUED; > + } > + > + rc = wait_for_completion_killable(&ctx->done); > + if (rc) { > + mutex_lock(&ctx->aio_mutex); > + ctx->rc = rc = -EINTR; > + total_written = ctx->total_len; > + mutex_unlock(&ctx->aio_mutex); > + } else { > + rc = ctx->rc; > + total_written = ctx->total_len; > + } > + > + kref_put(&ctx->refcount, cifs_aio_ctx_release); > + > + if (unlikely(!total_written)) > + return rc; > + > + iocb->ki_pos += total_written; > + return total_written; > +} > + > ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from) > { > struct file *file = iocb->ki_filp; > -- > 2.7.4 > -- Best regards, Pavel Shilovsky

Re: [PATCH V3 (resend) 3/7] CIFS: Add support for direct I/O read

2018-09-21 Thread Pavel Shilovsky
чт, 20 сент. 2018 г. в 14:22, Long Li : > > From: Long Li > > With direct I/O read, we transfer the data directly from transport layer to > the user data buffer. > > Change in v3: add support for kernel AIO > > Signed-off-by: Long Li > --- > fs/cifs/cifsfs.h | 1 + > fs/cifs/cifsglob.h | 5

Re: [Patch v2 15/15] CIFS: Add direct I/O functions to file_operations

2018-06-07 Thread Pavel Shilovsky
ect_writev, I would postpone making this change until we have asynchronous I/O support for direct mode. -- Best regards, Pavel Shilovsky

Re: [PATCH] cifs: dir: fix memory leak in cifs_mknod

2018-04-20 Thread Pavel Shilovsky
mba.org/sfrench/cifs-2.6.git/?p=sfrench/cifs-2.6.git;a=commit;h=167bc5de08dc97695f9d5c7069c3e69f409ff80b > > > Let me know if you see any problems with it. > Looks good. Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [Patch v4] cifs: Allocate validate negotiation request through kmalloc

2018-04-20 Thread Pavel Shilovsky
2018-04-20 7:55 GMT-07:00 Tom Talpey : > Looks good, but I have two possibly style-related comments. > > > On 4/19/2018 5:38 PM, Long Li wrote: >> >> From: Long Li >> >> The data buffer allocated on the stack can't be DMA'ed, ib_dma_map_page >> will >> return an invalid DMA address for a buffer on

Re: [PATCH] cifs: smb2ops: Fix NULL check in smb2_query_symlink

2018-04-13 Thread Pavel Shilovsky
gt; -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks! Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH 4.13 28/43] SMB3: Validate negotiate request must always be signed

2018-03-22 Thread Pavel Shilovsky
path? The patch looks good. Thanks for the backport. -- Best regards, Pavel Shilovsky

Re: [Patch v5 08/21] CIFS: SMBD: Upper layer reconnects to SMB Direct session

2017-11-01 Thread Pavel Shilovsky
ifs_dbg(FYI, "reconnect error %d\n", rc); > mutex_unlock(&server->srv_mutex); > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards, Pavel Shilovsky

Re: [Patch v5 02/21] CIFS: SMBD: Establish SMB Direct connection

2017-11-01 Thread Pavel Shilovsky
+ help > + Enables SMB Direct experimental support for SMB 3.0, 3.02 and 3.1.1. > + SMB Direct allows transferring SMB packets over RDMA. > + Please add "If unsure, say N." -- Best regards, Pavel Shilovsky

Re: [Patch v5 19/21] CIFS: SMBD: Read correct returned data length for RDMA write (SMB read) I/O

2017-11-01 Thread Pavel Shilovsky
-cifs_read_data_length(char *buf) > +cifs_read_data_length(char *buf, bool in_remaining) > { > READ_RSP *rsp = (READ_RSP *)buf; > + if (in_remaining) { > + cifs_dbg(VFS, "Invalid SMB1 calling path, check code\n"); I would suggest to do WARN_ON(1) instead. > + return 0; > + } > return (le16_to_cpu(rsp->DataLengthHigh) << 16) + >le16_to_cpu(rsp->DataLength); > } -- Best regards, Pavel Shilovsky

Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants

2017-08-30 Thread Pavel Shilovsky
2017-08-30 11:24 GMT-07:00 Long Li : >> -Original Message- >> From: Pavel Shilovsky [mailto:piastr...@gmail.com] >> Sent: Wednesday, August 30, 2017 11:19 AM >> To: Long Li >> Cc: Steve French ; linux-cifs > c...@vger.kernel.org>; samba-technical ;

Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants

2017-08-30 Thread Pavel Shilovsky
2017-08-29 16:00 GMT-07:00 Long Li : >> -Original Message- >> From: Pavel Shilovsky [mailto:piastr...@gmail.com] >> Sent: Tuesday, August 29, 2017 3:45 PM >> To: Long Li >> Cc: Steve French ; linux-cifs > c...@vger.kernel.org>; samba-technical ;

Re: [Patch v3 12/19] CIFS: SMBD: Fix the definition for SMB2_CHANNEL_RDMA_V1_INVALIDATE

2017-08-29 Thread Pavel Shilovsky
info at http://vger.kernel.org/majordomo-info.html If this is a bug in the existing code, this patch should go at the very beginning of the series. -- Best regards, Pavel Shilovsky

Re: [Patch v3 11/19] CIFS: SMBD: Define memory registration for I/O data

2017-08-29 Thread Pavel Shilovsky
g > More majordomo info at http://vger.kernel.org/majordomo-info.html The same thing: let's not add structure fields that the code doesn't do anything with. -- Best regards, Pavel Shilovsky

Re: [Patch v3 06/19] CIFS: SMBD: Reconnect to SMBDirect session

2017-08-29 Thread Pavel Shilovsky
2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html It is a easier to follow the logic if the definition is intro

Re: [Patch v3 04/19] CIFS: SMBD: Add SMBDirect transport to SMB connection and Makefile

2017-08-29 Thread Pavel Shilovsky
; buffer */ > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html It is better to split the current patch into 2 and merge the Makefile part to #3 and cifsglob.h part to #5. -- Best regards, Pavel Shilovsky

Re: [Patch v3 02/19] CIFS: SMBD: Add SMBDirect protocol and transport constants

2017-08-29 Thread Pavel Shilovsky
version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See > + * the GNU General Public License for more details. > + */ > +#ifndef _SMBDIRECT_H > +#define _SMBDIRECT_H > + > +#define SMBDIRECT_MAX_SGE 16 > +#endif > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best regards, Pavel Shilovsky

Re: [Patch v3 01/19] CIFS: Add rdma mount option

2017-08-29 Thread Pavel Shilovsky
e_info->noblocksnd; > tcp_ses->noautotune = volume_info->noautotune; > tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay; > + tcp_ses->rdma = volume_info->rdma; > tcp_ses->in_flight = 0; > tcp_ses->credits = 1; > init_waitqueue_head(&tcp_ses->response_q); > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html It is better to introduce a mount option after the functional changes not before them. In this case we do not result in having the mount option that does nothing if we break the patchset. -- Best regards, Pavel Shilovsky

Re: [PATCH v3] cifs: Do not modify mid entry after submitting I/O in cifs_call_async

2017-06-28 Thread Pavel Shilovsky
bscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks! Please fix the comment style to /* * */ Other than that - Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH resend] cifs: Do not modify mid entry after submitting I/O in cifs_call_async

2017-06-28 Thread Pavel Shilovsky
http://vger.kernel.org/majordomo-info.html Looks good. Could you please add an additional comment describing the behavior in the code? -- Best regards, Pavel Shilovsky

Re: [PATCH] CIFS: check if pages is null rather than bv for a failed allocation

2017-05-17 Thread Pavel Shilovsky
the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks for catching this! Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH] CIFS: silence lockdep splat in cifs_relock_file()

2017-05-09 Thread Pavel Shilovsky
); > if (cinode->can_cache_brlcks) { > /* can cache locks - no need to relock */ > up_read(&cinode->lock_sem); > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Pavel Shilovsky Best regards, Pavel Shilovsky

Re: [RFC 08/10] cifs: move to generic async completion

2017-05-08 Thread Pavel Shilovsky
_hdr->Signature, sign, SMB2_SIGNATURE_SIZE); > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Pavel Shilovsky Best regards, Pavel Shilovsky

Re: [PATCH] CIFS: use correct format string for size_t

2017-02-02 Thread Pavel Shilovsky
quot;unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html This issue have been already fixed in the Steve's for-next branch. Thanks. -- Best regards, Pavel Shilovsky

Re: [PATCH 0/3] cifs: Better dependencies

2017-01-25 Thread Pavel Shilovsky
sage to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Looks good. Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH] cifs: use %16phN for formatting md5 sum

2016-12-14 Thread Pavel Shilovsky
md5_hash) md5_hash > > static int > symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash) > -- > 2.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky

Re: [PATCH 3.14 103/114] CIFS: Fix directory rename error

2014-09-15 Thread Pavel Shilovsky
2014-09-15 23:26 GMT+04:00 Greg Kroah-Hartman : > 3.14-stable review patch. If anyone has any objections, please let me know. > > -- > > From: Pavel Shilovsky > > commit a07d322059db66b84c9eb4f98959df468e88b34b upstream. > > CIFS servers process nlink c

Re: [RFC PATCH] cifs: Fix possible deadlock with cifs and work queues

2014-03-21 Thread Pavel Shilovsky
why I agree with Jeff and suggest to move the oplock code to a different work queue (cifsioopd_wq?) but leave read and write codepaths use cifsiod_wq. -- Best regards, Pavel Shilovsky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message

Re: [PATCH v7 1/7] VFS: Introduce new O_DENY* open flags

2014-02-04 Thread Pavel Shilovsky
2014-02-01 Jeff Layton : > On Fri, 17 Jan 2014 14:07:06 +0400 > Pavel Shilovsky wrote: > >> This patch adds 3 flags: >> 1) O_DENYREAD that doesn't permit read access, >> 2) O_DENYWRITE that doesn't permit write access, >> 3) O_DENYDELETE that doe

Re: [PATCH v7 0/7] Add O_DENY* support for VFS and CIFS/NFS

2014-01-31 Thread Pavel Shilovsky
2014-01-17 Pavel Shilovsky : > This patchset adds support of O_DENY* flags for Linux fs layer. These flags > can be used by any application that needs share reservations to organize a > file access. VFS already has some sort of this capability - now it's done > through flock/L

Re: [PATCH v7 0/7] Add O_DENY* support for VFS and CIFS/NFS

2014-01-21 Thread Pavel Shilovsky
E flag that will force a file to be removed on close - we will be able to do O_DENYDELETE checks atomically. -- Best regards, Pavel Shilovsky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo in

Re: [PATCH v7 1/7] VFS: Introduce new O_DENY* open flags

2014-01-21 Thread Pavel Shilovsky
this behavior is dangerous to be on critical system paths like "/" or "/lib" and not suitable for global use. -- Best regards, Pavel Shilovsky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v7 1/7] VFS: Introduce new O_DENY* open flags

2014-01-20 Thread Pavel Shilovsky
} >> + >> + if (IS_SHARELOCK(dir->d_inode)) { >> + /* >> + * Lock parent i_mutex to prevent races with sharelocks on >> + * newly created files. >> + */ >> + mutex_lock(&dir-&g

Re: [PATCH v7 0/7] Add O_DENY* support for VFS and CIFS/NFS

2014-01-20 Thread Pavel Shilovsky
2014/1/20 Volker Lendecke : > Hi! > > On Fri, Jan 17, 2014 at 02:07:05PM +0400, Pavel Shilovsky wrote: >> If O_DENYDELETE flag is specified and the open succeded, >> any further unlink operation will fail with -ESHAREDENIED >> untill this open is closed. Now this flag

Re: [PATCH v7 0/7] Add O_DENY* support for VFS and CIFS/NFS

2014-01-20 Thread Pavel Shilovsky
But we can add a functionality to let flock syscall change deny modes as on option. -- Best regards, Pavel Shilovsky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vg

[PATCH v7 3/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts

2014-01-17 Thread Pavel Shilovsky
Signed-off-by: Pavel Shilovsky --- fs/locks.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/locks.c b/fs/locks.c index 7ecc511..c7e780a 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1904,6 +1904,12 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd

[PATCH v7 0/7] Add O_DENY* support for VFS and CIFS/NFS

2014-01-17 Thread Pavel Shilovsky
!O_DENYDELETE -> LOCK_DELETE | LOCK_MAND - Pavel Shilovsky (7): VFS: Introduce new O_DENY* open flags VFS: Add O_DENYDELETE support for VFS locks: Disable LOCK_MAND support for MS_SHARELOCK mounts CIFS: Add O_DENY* open flags support NFSD: Pass share reservations flags to VFS NFSv4: A

[PATCH v7 1/7] VFS: Introduce new O_DENY* open flags

2014-01-17 Thread Pavel Shilovsky
es on newly created files: when open with O_CREAT can return -ESHAREDENIED error for successfully created files due to a sharelock set by another task. Temporary disable O_DENYDELETE support - will enable it in further patches. Signed-off-by: Pavel Shilovsky --- arch/alpha/include/uapi/asm/errno.

[PATCH v7 7/7] NFSv4: Add O_DENY* open flags support

2014-01-17 Thread Pavel Shilovsky
vious open requests to the server during delegation recall because of possible conflicts with deny modes. Signed-off-by: Pavel Shilovsky --- fs/nfs/dir.c | 39 ++- fs/nfs/inode.c |3 +- fs/nfs/internal.h |3 +- fs/nfs/nfs4_fs.h | 48 -- f

[PATCH v7 6/7] NFSv4: Add deny state handling for nfs4_state struct

2014-01-17 Thread Pavel Shilovsky
and prepare code intrastructure to handle O_DENY* flags. Signed-off-by: Pavel Shilovsky --- fs/nfs/dir.c|2 +- fs/nfs/inode.c |7 +- fs/nfs/nfs4_fs.h| 41 +- fs/nfs/nfs4file.c |2 +- fs/nfs/nfs4proc.c | 194

[PATCH v7 4/7] CIFS: Add O_DENY* open flags support

2014-01-17 Thread Pavel Shilovsky
: Pavel Shilovsky --- fs/cifs/cifsacl.c |2 ++ fs/cifs/cifsfs.c |2 +- fs/cifs/cifsglob.h | 17 - fs/cifs/cifssmb.c |2 +- fs/cifs/dir.c |6 ++ fs/cifs/file.c | 20 +--- fs/cifs/inode.c| 12

[PATCH v7 5/7] NFSD: Pass share reservations flags to VFS

2014-01-17 Thread Pavel Shilovsky
that maps them into O_DENY* flags and make them visible for applications on mounts with sharelock option. Signed-off-by: Pavel Shilovsky --- fs/locks.c |1 + fs/nfsd/nfs4state.c | 46 +- fs/nfsd/nfsproc.c |1 + 3 files changed, 47

[PATCH v7 2/7] VFS: Add O_DENYDELETE support for VFS

2014-01-17 Thread Pavel Shilovsky
Introduce new LOCK_DELETE flock flag that is suggested to be used internally only to map O_DENYDELETE open flag: !O_DENYDELETE -> LOCK_DELETE | LOCK_MAND. Signed-off-by: Pavel Shilovsky --- fs/locks.c | 56 -- fs/name

Re: 3.11+ Problem with cifs links, bisected

2013-10-23 Thread Pavel Shilovsky
licated >> files (from windows 2012 deduplication), as they would show up either >> garbled or 'ls' would complain it couldn't follow them. >> >> Git bisect blames the following: >> commit b42bf88828cde60772dc08201d0a4f1a0663d7bc >> CIFS: Implement f

Re: CIFS-related deadlock in 3.10-rc7

2013-07-11 Thread Pavel Shilovsky
2013/7/11 Steve French : > Wouldn't this be a candidate for stable? Yes, I think it should go to stable as well as "[PATCH 1/8] CIFS: Fix lease context buffer parsing" patch. -- Best regards, Pavel Shilovsky. -- To unsubscribe from this list: send the line "unsubscribe li

Re: CIFS-related deadlock in 3.10-rc7

2013-07-11 Thread Pavel Shilovsky
x75/0xb0 > [ 2164.132681] [] vfs_read+0xa7/0x180 > [ 2164.132686] [] SyS_read+0x50/0xa0 > [ 2164.132691] [] system_call_fastpath+0x1a/0x1f > > -- > Alexander E. Patrakov > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body

[PATCH v7 4/7] CIFS: Add O_DENY* open flags support

2013-07-01 Thread Pavel Shilovsky
: Pavel Shilovsky --- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsglob.h | 16 +++- fs/cifs/dir.c | 4 fs/cifs/file.c | 15 +-- fs/cifs/inode.c| 5 +++-- fs/cifs/netmisc.c | 2 +- fs/cifs/smb2maperror.c | 2 +- fs/locks.c

[PATCH v7 3/7] CIFS: Add share_access parm to open request

2013-07-01 Thread Pavel Shilovsky
and simplify CIFSSMBOpen params. Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsacl.c | 8 fs/cifs/cifsglob.h | 2 +- fs/cifs/cifsproto.h | 8 fs/cifs/cifssmb.c | 50 +++--- fs/cifs/dir.c | 12 ++-- fs/cifs

[PATCH v7 2/7] VFS: Add O_DENYDELETE support for VFS

2013-07-01 Thread Pavel Shilovsky
Introduce new LOCK_DELETE flock flag that is suggested to be used internally only to map O_DENYDELETE open flag: !O_DENYDELETE -> LOCK_DELETE | LOCK_MAND. Signed-off-by: Pavel Shilovsky --- fs/locks.c | 55 +--- fs/name

[PATCH v7 5/7] NFSv4: Add O_DENY* open flags support

2013-07-01 Thread Pavel Shilovsky
by passing these flags to NFSv4 open request. Make it return -ESHAREDENIED on share conflicts with other opens and disable O_DENYDELETE support since NFSv4 doesn't support it. Signed-off-by: Pavel Shilovsky --- fs/nfs/dir.c | 4 fs/nfs/internal.h | 3 ++- fs/nfs/nfs4file.c

[PATCH v7 6/7] NFSD: Pass share reservations flags to VFS

2013-07-01 Thread Pavel Shilovsky
that maps them into O_DENY* flags and make them visible for applications on mounts with sharelock option. Signed-off-by: Pavel Shilovsky --- fs/locks.c | 1 + fs/nfsd/nfs4state.c | 46 +- fs/nfsd/nfsproc.c | 1 + 3 files changed, 47

[PATCH v7 1/7] VFS: Introduce new O_DENY* open flags

2013-07-01 Thread Pavel Shilovsky
es on newly created files: when open with O_CREAT can return -ESHAREDENIED error for successfully created files due to a sharelock set by another task. Temporary disable O_DENYDELETE support - will enable it in further patches. Signed-off-by: Pavel Shilovsky --- arch/alpha/include/uapi/asm/err

[PATCH v7 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts

2013-07-01 Thread Pavel Shilovsky
Signed-off-by: Pavel Shilovsky --- fs/locks.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/locks.c b/fs/locks.c index 60f3ce8..86f3a93 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1758,6 +1758,12 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) goto

[PATCH v7 0/7] Add O_DENY* support for VFS and CIFS/NFS

2013-07-01 Thread Pavel Shilovsky
done through flocks. If O_DENY* flags are specified, flock syscall is processed after the open. The share modes are translated into flock according the following rules: 1) !O_DENYREAD -> LOCK_READ | LOCK_MAND 2) !O_DENYWRITE -> LOCK_WRITE | LOCK_MAND 3) !O_DENYDELETE -> LOCK_DELETE | LOCK_MA

Re: [PATCH v6 2/7] VFS: Add O_DENYDELETE support for VFS

2013-06-11 Thread Pavel Shilovsky
2013/6/11 Jeff Layton : > On Fri, 26 Apr 2013 16:04:16 +0400 > Pavel Shilovsky wrote: > >> Introduce new LOCK_DELETE flock flag that is suggested to be used >> internally only to map O_DENYDELETE open flag: >> >> !O_DENYDELETE -> LOCK_DELETE | LOCK_MAND.

Re: Mount failure due to restricted access to a point along the mount path

2013-05-15 Thread Pavel Shilovsky
r the inode in that case is the pathname. > > Perhaps we'd be best off to just rip out the sb sharing after all. > Getting all of the corner cases right when the protocol and server > implementations are so problematic is really, really difficult. > > If we do go that route, then

Re: [PATCH v6 2/7] VFS: Add O_DENYDELETE support for VFS

2013-05-13 Thread Pavel Shilovsky
2013/5/10 Jeff Layton : > On Fri, 26 Apr 2013 16:04:16 +0400 > Pavel Shilovsky wrote: > >> Introduce new LOCK_DELETE flock flag that is suggested to be used >> internally only to map O_DENYDELETE open flag: >> >> !O_DENYDELETE -> LOCK_DELETE | LOCK_MAND.

[PATCH v6 1/7] VFS: Introduce new O_DENY* open flags

2013-04-26 Thread Pavel Shilovsky
s on newely created files: when open with O_CREAT can return -ESHAREDENIED error for successfully created files due to a sharelock set by another task. Temporary disable O_DENYDELETE support - will enable it in further patches. Signed-off-by: Pavel Shilovsky --- fs/fcntl.c

[PATCH v6 4/7] CIFS: Add O_DENY* open flags support

2013-04-26 Thread Pavel Shilovsky
: Pavel Shilovsky --- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsglob.h | 16 +++- fs/cifs/dir.c | 4 fs/cifs/file.c | 15 +-- fs/cifs/inode.c| 5 +++-- fs/cifs/netmisc.c | 2 +- fs/cifs/smb2maperror.c | 2 +- fs/locks.c

[PATCH v6 5/7] NFSv4: Add O_DENY* open flags support

2013-04-26 Thread Pavel Shilovsky
by passing these flags to NFSv4 open request. Make it return -ESHAREDENIED on share conflicts with other opens and disable O_DENYDELETE support since NFSv4 doesn't support it. Signed-off-by: Pavel Shilovsky --- fs/nfs/dir.c | 4 fs/nfs/internal.h | 3 ++- fs/nfs/nfs4file.c

[PATCH v6 2/7] VFS: Add O_DENYDELETE support for VFS

2013-04-26 Thread Pavel Shilovsky
Introduce new LOCK_DELETE flock flag that is suggested to be used internally only to map O_DENYDELETE open flag: !O_DENYDELETE -> LOCK_DELETE | LOCK_MAND. Signed-off-by: Pavel Shilovsky --- fs/locks.c | 53 +--- fs/name

[PATCH v6 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts

2013-04-26 Thread Pavel Shilovsky
Signed-off-by: Pavel Shilovsky --- fs/locks.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/locks.c b/fs/locks.c index 25c3a49..7d67e0e 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1756,6 +1756,12 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) goto

[PATCH v6 6/7] NFSD: Pass share reservations flags to VFS

2013-04-26 Thread Pavel Shilovsky
that maps them into O_DENY* flags and make them visible for applications on mounts with sharelock option. Signed-off-by: Pavel Shilovsky --- fs/locks.c | 1 + fs/nfsd/nfs4state.c | 46 +- fs/nfsd/nfsproc.c | 1 + 3 files changed, 47

[PATCH v6 3/7] CIFS: Add share_access parm to open request

2013-04-26 Thread Pavel Shilovsky
and simplify CIFSSMBOpen params. Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsacl.c | 8 fs/cifs/cifsglob.h | 2 +- fs/cifs/cifsproto.h | 8 fs/cifs/cifssmb.c | 50 +++--- fs/cifs/dir.c | 12 ++-- fs/cifs

[PATCH v6 0/7] Add O_DENY* support for VFS and CIFS/NFS

2013-04-26 Thread Pavel Shilovsky
k syscall is processed after the open. The share modes are translated into flock according the following rules: 1) !O_DENYREAD -> LOCK_READ | LOCK_MAND 2) !O_DENYWRITE -> LOCK_WRITE | LOCK_MAND 3) !O_DENYDELETE -> LOCK_DELETE | LOCK_MAND - Pavel Shilovsky (7): VFS: Introduc

Re: [PATCH v5 4/7] CIFS: Use NT_CREATE_ANDX command for forcemand mounts

2013-04-10 Thread Pavel Shilovsky
/* use NT_CREATE_ANDX */ else /* use TRANS2 OPEN */ -- Best regards, Pavel Shilovsky. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v5 1/7] fcntl: Introduce new O_DENY* open flags

2013-04-10 Thread Pavel Shilovsky
2013/4/10 Jeff Layton : > On Tue, 9 Apr 2013 16:40:21 +0400 > Pavel Shilovsky wrote: > >> This patch adds 3 flags: >> 1) O_DENYREAD that doesn't permit read access, >> 2) O_DENYWRITE that doesn't permit write access, >> 3) O_DENYDELETE that doe

Re: [PATCH v5 4/7] CIFS: Use NT_CREATE_ANDX command for forcemand mounts

2013-04-10 Thread Pavel Shilovsky
2013/4/10 Jeff Layton : > On Tue, 9 Apr 2013 16:40:24 +0400 > Pavel Shilovsky wrote: > >> forcemand mount option now lets us use Windows mandatory style of >> byte-range locks even if server supports posix ones - switches on >> Windows locking mechanism. Share flags

[PATCH v5 2/7] CIFS: Add share_access parm to open request

2013-04-09 Thread Pavel Shilovsky
and simplify CIFSSMBOpen params. Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsacl.c | 8 fs/cifs/cifsglob.h | 2 +- fs/cifs/cifsproto.h | 8 fs/cifs/cifssmb.c | 50 +++--- fs/cifs/dir.c | 12 ++-- fs/cifs

[PATCH v5 4/7] CIFS: Use NT_CREATE_ANDX command for forcemand mounts

2013-04-09 Thread Pavel Shilovsky
Windows locking mechanism in one mount option by using NT_CREATE_ANDX to open files if forcemand is on. Signed-off-by: Pavel Shilovsky --- fs/cifs/dir.c | 1 + fs/cifs/file.c | 6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index d4331de

[PATCH v5 0/7] Add O_DENY* support for VFS and CIFS/NFS

2013-04-09 Thread Pavel Shilovsky
rules: 1) !O_DENYREAD -> LOCK_READ | LOCK_MAND 2) !O_DENYWRITE -> LOCK_WRITE | LOCK_MAND - Pavel Shilovsky (7): fcntl: Introduce new O_DENY* open flags CIFS: Add share_access parm to open request CIFS: Add O_DENY* open flags support CIFS: Use NT_CREATE_ANDX command for forcemand mount

[PATCH v5 6/7] NFSD: Pass share reservations flags to VFS

2013-04-09 Thread Pavel Shilovsky
that maps them into O_DENY flags and make them visible for applications that use O_DENYMAND opens. Signed-off-by: Pavel Shilovsky --- fs/locks.c | 1 + fs/nfsd/nfs4state.c | 46 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git

[PATCH v5 5/7] NFSv4: Add O_DENY* open flags support

2013-04-09 Thread Pavel Shilovsky
by passing these flags to NFSv4 open request. Also make it return -EBUSY on share conflicts with other opens. Signed-off-by: Pavel Shilovsky --- fs/nfs/internal.h | 3 ++- fs/nfs/nfs4proc.c | 4 +++- fs/nfs/nfs4super.c | 9 ++--- fs/nfs/nfs4xdr.c | 21 + fs/nfs

[PATCH v5 3/7] CIFS: Add O_DENY* open flags support

2013-04-09 Thread Pavel Shilovsky
Construct share_access value from O_DENY* flags and send it to the server. Signed-off-by: Pavel Shilovsky --- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsglob.h | 16 +++- fs/cifs/dir.c | 3 +++ fs/cifs/file.c | 4 fs/locks.c | 7 ++- include/linux/fs.h | 1

[PATCH v5 7/7] locks: Disable LOCK_MAND support for MS_SHARELOCK mounts

2013-04-09 Thread Pavel Shilovsky
Signed-off-by: Pavel Shilovsky --- fs/locks.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/locks.c b/fs/locks.c index 1402a43..a67857c 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1719,6 +1719,12 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) if (!f.file

  1   2   >