From patchwork Thu Jul 19 14:15:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10534617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 35DD3600F4 for ; Thu, 19 Jul 2018 14:16:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1775629AE1 for ; Thu, 19 Jul 2018 14:16:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BBC429AE4; Thu, 19 Jul 2018 14:16:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2A5E29AE3 for ; Thu, 19 Jul 2018 14:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731766AbeGSO7q (ORCPT ); Thu, 19 Jul 2018 10:59:46 -0400 Received: from mout.gmx.net ([212.227.15.15]:44219 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731468AbeGSO7p (ORCPT ); Thu, 19 Jul 2018 10:59:45 -0400 Received: from localhost.localdomain ([116.30.194.72]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LpKKr-1gCAYZ1xNV-00fDW2; Thu, 19 Jul 2018 16:16:19 +0200 From: Chengguang Xu To: zyan@redhat.com Cc: idryomov@gmail.com, ceph-devel@vger.kernel.org, Chengguang Xu Subject: [PATCH v2 4/4] ceph: compare fsc->max_file_size and inode->i_size for max file size limit Date: Thu, 19 Jul 2018 22:15:27 +0800 Message-Id: <20180719141527.5446-5-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180719141527.5446-1-cgxu519@gmx.com> References: <20180719141527.5446-1-cgxu519@gmx.com> X-Provags-ID: V03:K1:eP1D+OCPcZ7hCmWvTa062atQG3GvUpHipdZ8MoY2uzkAUe556fi iI5MODsLmOiZakOP+Y1Ii6hEyXZToU/H5sUtSnWNezWSWtgXr9LhQwWBE7EQzM78ZqnrCl/ zYvIhkg2WyyQaXq0eA2oXPVYb71JnACTsToB8yi+Ahynz/IuiETYhYR0uOkRSj/zxOsPxXX I0wfh14ivHCc3uEOiM+uQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:q09VA4PBgWY=:86e+UnNwMvSj0+mPP/NztH uMc+Rg4tFgUXtLWpzF4SuDi/8V1r3YASHlrOtUaJB+k+BpHYkUxzuX+dU27YSZHq4C8D/OkKo q+hf0Ft57H9mp6mtBpy7TBzbJEiwmePTW4D2WUoryuZZhYmBhyyJJeIadpcnm8e63MwGu/SaY ub21eMZV0iTR1Sqxq6ZY6aQnNzaQxg74RaUdusi/ovp9f3rzuDKzgM5BCKoP+KksGwCkBBjG3 iBCfwpVFisorQpz3p1od3cAUNNqBQy7Mo2OZF6ks9Te33QFNbfj34H2e1PY6gCd1AIi48/YT3 EtWM5iBZCyC23IF8oXfyw0GOF+RZJYgtEu61IB0w8U4VECnhEn+lgmER1+h0GMSuEu1rRcbjv BXLRJaXQnBjLO6EVhntRmfX44Yp1herRkIG80QI4ieikm/mfViogJ9OJvW/waTsV5C5q0I/PF D1PeUKFMBQmnsb0Gdcs08RBa9tDzBjjucVDyWF+EvKKlUDTInYeyAonZTpJfQicXZLyOJW2C5 8f1SYt+TTz/xrKX74zBppcXN650UEtZVscoWqyp/dWDTWM+ykWAPj+VRJ8yB7P6EjgFEHzMrW XprGqL+Pg8GMcbfoELv4fSkWPa21hWfl2YK1FAU2Xg/2GYmg7zv4JlxKgGTZCi1H3moJmVaCU HkzQGCkbtUltNWaPE9wzkooRUabrmwRn3GWeN89IYgsVVoaw7FPJlEKuR318J7iLZDIt8VUDU v0P0ChP0fQk4hRwxrxOmKh/Ez6a3uSpdIx+njJ/Q74DuunwIniRaKI4OmbI= Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In ceph_llseek(), we compare fsc->max_file_size and inode->i_siz to choose max file size limit. Signed-off-by: Chengguang Xu --- fs/ceph/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 7a01fe627bd7..27500fedae1e 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1556,8 +1556,10 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) { struct inode *inode = file->f_mapping->host; + struct ceph_fs_client *fsc = inode->i_sb->s_fs_info; loff_t i_size; loff_t ret; + loff_t limit; inode_lock(inode); @@ -1600,7 +1602,8 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) break; } - ret = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); + limit = max(i_size, fsc->max_file_size); + ret = vfs_setpos(file, offset, limit); out: inode_unlock(inode);