cifs: remove old dead code
authorAurelien Aptel <aaptel@suse.com>
Mon, 12 Apr 2021 16:01:43 +0000 (18:01 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 25 Apr 2021 21:28:22 +0000 (16:28 -0500)
While reviewing a patch clarifying locks and locking hierarchy I
realized some locks were unused.

This commit removes old data and code that isn't actually used
anywhere, or hidden in ifdefs which cannot be enabled from the kernel
config.

* The uid/gid trees and associated locks are left-overs from when
  uid/sid mapping had an extra caching layer on top of the keyring and
  are now unused.
  See commit faa65f07d21e ("cifs: simplify id_to_sid and sid_to_id mapping code")
  from 2012.

* cifs_oplock_break_ops is a left-over from when slow_work was remplaced
  by regular workqueue and is now unused.
  See commit 9b646972467f ("cifs: use workqueue instead of slow-work")
  from 2010.

* CIFSSMBSetAttrLegacy is SMB1 cruft dealing with some legacy
  NT4/Win9x behaviour.

* Remove CONFIG_CIFS_DNOTIFY_EXPERIMENTAL left-overs. This was already
  partially removed in 392e1c5dc9cc ("cifs: rename and clarify CIFS_ASYNC_OP and CIFS_NO_RESP")
  from 2019. Kill it completely.

* Another candidate that was considered but spared is
  CONFIG_CIFS_NFSD_EXPORT which has an empty implementation and cannot
  be enabled by a config option (although it is listed but disabled with
  "BROKEN" as a dep). It's unclear whether this could even function
  today in its current form but it has it's own .c file and Kconfig
  entry which is a bit more involved to remove and might make a come
  back?

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/inode.c

index 1b65ff9e9189e06047281f19aec6a0ae3192555c..8dc2306c9092a507c26d58c62b541d4b13c51f7e 100644 (file)
@@ -1526,10 +1526,6 @@ init_cifs(void)
        int rc = 0;
        cifs_proc_init();
        INIT_LIST_HEAD(&cifs_tcp_ses_list);
-#ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */
-       INIT_LIST_HEAD(&GlobalDnotifyReqList);
-       INIT_LIST_HEAD(&GlobalDnotifyRsp_Q);
-#endif /* was needed for dnotify, and will be needed for inotify when VFS fix */
 /*
  *  Initialize Global counters
  */
index 298a185e6516af832768fd0288893bce641789d6..18a5505a506cb7ba453b7c680e39d92197af3544 100644 (file)
@@ -1824,13 +1824,6 @@ GLOBAL_EXTERN struct list_head           cifs_tcp_ses_list;
  */
 GLOBAL_EXTERN spinlock_t               cifs_tcp_ses_lock;
 
-#ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */
-/* Outstanding dir notify requests */
-GLOBAL_EXTERN struct list_head GlobalDnotifyReqList;
-/* DirNotify response queue */
-GLOBAL_EXTERN struct list_head GlobalDnotifyRsp_Q;
-#endif /* was needed for dnotify, and will be needed for inotify when VFS fix */
-
 /*
  * Global transaction id (XID) information
  */
@@ -1874,19 +1867,9 @@ extern unsigned int cifs_min_small;  /* min size of small buf pool */
 extern unsigned int cifs_max_pending; /* MAX requests at once to server*/
 extern bool disable_legacy_dialects;  /* forbid vers=1.0 and vers=2.0 mounts */
 
-GLOBAL_EXTERN struct rb_root uidtree;
-GLOBAL_EXTERN struct rb_root gidtree;
-GLOBAL_EXTERN spinlock_t siduidlock;
-GLOBAL_EXTERN spinlock_t sidgidlock;
-GLOBAL_EXTERN struct rb_root siduidtree;
-GLOBAL_EXTERN struct rb_root sidgidtree;
-GLOBAL_EXTERN spinlock_t uidsidlock;
-GLOBAL_EXTERN spinlock_t gidsidlock;
-
 void cifs_oplock_break(struct work_struct *work);
 void cifs_queue_oplock_break(struct cifsFileInfo *cfile);
 
-extern const struct slow_work_ops cifs_oplock_break_ops;
 extern struct workqueue_struct *cifsiod_wq;
 extern struct workqueue_struct *decrypt_wq;
 extern struct workqueue_struct *fileinfo_put_wq;
index 75ce6f742b8d76203f2e6d9f9179bf2c113a108b..10c84a8159d7dbc7fc99d6706382d3358150f5fe 100644 (file)
@@ -358,11 +358,6 @@ extern int CIFSSMBSetFileDisposition(const unsigned int xid,
                                     struct cifs_tcon *tcon,
                                     bool delete_file, __u16 fid,
                                     __u32 pid_of_opener);
-#if 0
-extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon,
-                       char *fileName, __u16 dos_attributes,
-                       const struct nls_table *nls_codepage);
-#endif /* possibly unneeded function */
 extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon,
                         const char *file_name, __u64 size,
                         struct cifs_sb_info *cifs_sb, bool set_allocation);
@@ -504,12 +499,6 @@ extern int generate_smb311signingkey(struct cifs_ses *);
 extern int calc_lanman_hash(const char *password, const char *cryptkey,
                                bool encrypt, char *lnm_session_key);
 #endif /* CIFS_WEAK_PW_HASH */
-#ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */
-extern int CIFSSMBNotify(const unsigned int xid, struct cifs_tcon *tcon,
-                       const int notify_subdirs, const __u16 netfid,
-                       __u32 filter, struct file *file, int multishot,
-                       const struct nls_table *nls_codepage);
-#endif /* was needed for dnotify, and will be needed for inotify when VFS fix */
 extern int CIFSSMBCopy(unsigned int xid,
                        struct cifs_tcon *source_tcon,
                        const char *fromName,
index c279527aae92d382af7ac5aa1c3a718e2d7f8306..7fcc0fc4e68b73897b058182d90b3ca15d3f6364 100644 (file)
@@ -5917,56 +5917,6 @@ SetTimesRetry:
        return rc;
 }
 
-/* Can not be used to set time stamps yet (due to old DOS time format) */
-/* Can be used to set attributes */
-#if 0  /* Possibly not needed - since it turns out that strangely NT4 has a bug
-         handling it anyway and NT4 was what we thought it would be needed for
-         Do not delete it until we prove whether needed for Win9x though */
-int
-CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon, char *fileName,
-               __u16 dos_attrs, const struct nls_table *nls_codepage)
-{
-       SETATTR_REQ *pSMB = NULL;
-       SETATTR_RSP *pSMBr = NULL;
-       int rc = 0;
-       int bytes_returned;
-       int name_len;
-
-       cifs_dbg(FYI, "In SetAttrLegacy\n");
-
-SetAttrLgcyRetry:
-       rc = smb_init(SMB_COM_SETATTR, 8, tcon, (void **) &pSMB,
-                     (void **) &pSMBr);
-       if (rc)
-               return rc;
-
-       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
-               name_len =
-                       ConvertToUTF16((__le16 *) pSMB->fileName, fileName,
-                                      PATH_MAX, nls_codepage);
-               name_len++;     /* trailing null */
-               name_len *= 2;
-       } else {
-               name_len = copy_path_name(pSMB->fileName, fileName);
-       }
-       pSMB->attr = cpu_to_le16(dos_attrs);
-       pSMB->BufferFormat = 0x04;
-       inc_rfc1001_len(pSMB, name_len + 1);
-       pSMB->ByteCount = cpu_to_le16(name_len + 1);
-       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
-                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-       if (rc)
-               cifs_dbg(FYI, "Error in LegacySetAttr = %d\n", rc);
-
-       cifs_buf_release(pSMB);
-
-       if (rc == -EAGAIN)
-               goto SetAttrLgcyRetry;
-
-       return rc;
-}
-#endif /* temporarily unneeded SetAttr legacy function */
-
 static void
 cifs_fill_unix_set_info(FILE_UNIX_BASIC_INFO *data_offset,
                        const struct cifs_unix_set_info_args *args)
index f2df4422e54ae0c8262860165a93a8d96df229e2..2a73ae04b7410eb3e781e411276181412c9c7c29 100644 (file)
@@ -2961,12 +2961,3 @@ cifs_setattr(struct user_namespace *mnt_userns, struct dentry *direntry,
        /* BB: add cifs_setattr_legacy for really old servers */
        return rc;
 }
-
-#if 0
-void cifs_delete_inode(struct inode *inode)
-{
-       cifs_dbg(FYI, "In cifs_delete_inode, inode = 0x%p\n", inode);
-       /* may have to add back in if and when safe distributed caching of
-          directories added e.g. via FindNotify */
-}
-#endif