mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 13:34:30 +00:00
Merge branch 'master' of https://github.com/Paragon-Software-Group/linux-ntfs3.git
This commit is contained in:
commit
c13e866158
@ -1173,7 +1173,7 @@ int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
|
||||
{
|
||||
struct ntfs_sb_info *sbi = ni->mi.sbi;
|
||||
u8 cluster_bits = sbi->cluster_bits;
|
||||
CLST vcn = from >> cluster_bits;
|
||||
CLST vcn;
|
||||
CLST vcn_last = (to - 1) >> cluster_bits;
|
||||
CLST lcn, clen;
|
||||
int err;
|
||||
|
@ -1333,9 +1333,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
|
||||
if (!new_free)
|
||||
return -ENOMEM;
|
||||
|
||||
if (new_free != wnd->free_bits)
|
||||
memcpy(new_free, wnd->free_bits,
|
||||
wnd->nwnd * sizeof(short));
|
||||
memcpy(new_free, wnd->free_bits, wnd->nwnd * sizeof(short));
|
||||
memset(new_free + wnd->nwnd, 0,
|
||||
(new_wnd - wnd->nwnd) * sizeof(short));
|
||||
kfree(wnd->free_bits);
|
||||
|
@ -989,7 +989,6 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
|
||||
if (bytes > count)
|
||||
bytes = count;
|
||||
|
||||
frame = pos >> frame_bits;
|
||||
frame_vbo = pos & ~(frame_size - 1);
|
||||
index = frame_vbo >> PAGE_SHIFT;
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <linux/fiemap.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/minmax.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "debug.h"
|
||||
@ -649,6 +650,7 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
|
||||
struct mft_inode *mi;
|
||||
u32 asize, free;
|
||||
struct MFT_REF ref;
|
||||
struct MFT_REC *mrec;
|
||||
__le16 id;
|
||||
|
||||
if (!ni->attr_list.dirty)
|
||||
@ -692,11 +694,17 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
|
||||
free -= asize;
|
||||
}
|
||||
|
||||
/* Make a copy of primary record to restore if error. */
|
||||
mrec = kmemdup(ni->mi.mrec, sbi->record_size, GFP_NOFS);
|
||||
if (!mrec)
|
||||
return 0; /* Not critical. */
|
||||
|
||||
/* It seems that attribute list can be removed from primary record. */
|
||||
mi_remove_attr(NULL, &ni->mi, attr_list);
|
||||
|
||||
/*
|
||||
* Repeat the cycle above and move all attributes to primary record.
|
||||
* Repeat the cycle above and copy all attributes to primary record.
|
||||
* Do not remove original attributes from subrecords!
|
||||
* It should be success!
|
||||
*/
|
||||
le = NULL;
|
||||
@ -707,14 +715,14 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
|
||||
mi = ni_find_mi(ni, ino_get(&le->ref));
|
||||
if (!mi) {
|
||||
/* Should never happened, 'cause already checked. */
|
||||
goto bad;
|
||||
goto out;
|
||||
}
|
||||
|
||||
attr = mi_find_attr(mi, NULL, le->type, le_name(le),
|
||||
le->name_len, &le->id);
|
||||
if (!attr) {
|
||||
/* Should never happened, 'cause already checked. */
|
||||
goto bad;
|
||||
goto out;
|
||||
}
|
||||
asize = le32_to_cpu(attr->size);
|
||||
|
||||
@ -724,18 +732,33 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
|
||||
le16_to_cpu(attr->name_off));
|
||||
if (!attr_ins) {
|
||||
/*
|
||||
* Internal error.
|
||||
* Either no space in primary record (already checked).
|
||||
* Either tried to insert another
|
||||
* non indexed attribute (logic error).
|
||||
* No space in primary record (already checked).
|
||||
*/
|
||||
goto bad;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Copy all except id. */
|
||||
id = attr_ins->id;
|
||||
memcpy(attr_ins, attr, asize);
|
||||
attr_ins->id = id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Repeat the cycle above and remove all attributes from subrecords.
|
||||
*/
|
||||
le = NULL;
|
||||
while ((le = al_enumerate(ni, le))) {
|
||||
if (!memcmp(&le->ref, &ref, sizeof(ref)))
|
||||
continue;
|
||||
|
||||
mi = ni_find_mi(ni, ino_get(&le->ref));
|
||||
if (!mi)
|
||||
continue;
|
||||
|
||||
attr = mi_find_attr(mi, NULL, le->type, le_name(le),
|
||||
le->name_len, &le->id);
|
||||
if (!attr)
|
||||
continue;
|
||||
|
||||
/* Remove from original record. */
|
||||
mi_remove_attr(NULL, mi, attr);
|
||||
@ -748,11 +771,13 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
|
||||
ni->attr_list.le = NULL;
|
||||
ni->attr_list.dirty = false;
|
||||
|
||||
kfree(mrec);
|
||||
return 0;
|
||||
out:
|
||||
/* Restore primary record. */
|
||||
swap(mrec, ni->mi.mrec);
|
||||
kfree(mrec);
|
||||
return 0;
|
||||
bad:
|
||||
ntfs_inode_err(&ni->vfs_inode, "Internal error");
|
||||
make_bad_inode(&ni->vfs_inode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3843,6 +3843,8 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
|
||||
|
||||
memset(&rst_info2, 0, sizeof(struct restart_info));
|
||||
err = log_read_rst(log, l_size, false, &rst_info2);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
/* Determine which restart area to use. */
|
||||
if (!rst_info2.restart || rst_info2.last_lsn <= rst_info.last_lsn)
|
||||
@ -5057,7 +5059,7 @@ undo_action_next:
|
||||
goto add_allocated_vcns;
|
||||
|
||||
vcn = le64_to_cpu(lrh->target_vcn);
|
||||
vcn &= ~(log->clst_per_page - 1);
|
||||
vcn &= ~(u64)(log->clst_per_page - 1);
|
||||
|
||||
add_allocated_vcns:
|
||||
for (i = 0, vcn = le64_to_cpu(lrh->target_vcn),
|
||||
|
@ -1042,19 +1042,16 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni,
|
||||
{
|
||||
int err;
|
||||
struct NTFS_DE *e;
|
||||
const struct INDEX_HDR *hdr;
|
||||
struct indx_node *node;
|
||||
|
||||
if (!root)
|
||||
root = indx_get_root(&ni->dir, ni, NULL, NULL);
|
||||
|
||||
if (!root) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
/* Should not happen. */
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdr = &root->ihdr;
|
||||
|
||||
/* Check cache. */
|
||||
e = fnd->level ? fnd->de[fnd->level - 1] : fnd->root_de;
|
||||
if (e && !de_is_last(e) &&
|
||||
@ -1068,39 +1065,35 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni,
|
||||
fnd_clear(fnd);
|
||||
|
||||
/* Lookup entry that is <= to the search value. */
|
||||
e = hdr_find_e(indx, hdr, key, key_len, ctx, diff);
|
||||
e = hdr_find_e(indx, &root->ihdr, key, key_len, ctx, diff);
|
||||
if (!e)
|
||||
return -EINVAL;
|
||||
|
||||
fnd->root_de = e;
|
||||
err = 0;
|
||||
|
||||
for (;;) {
|
||||
node = NULL;
|
||||
if (*diff >= 0 || !de_has_vcn_ex(e)) {
|
||||
*entry = e;
|
||||
goto out;
|
||||
}
|
||||
if (*diff >= 0 || !de_has_vcn_ex(e))
|
||||
break;
|
||||
|
||||
/* Read next level. */
|
||||
err = indx_read(indx, ni, de_get_vbn(e), &node);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
|
||||
/* Lookup entry that is <= to the search value. */
|
||||
e = hdr_find_e(indx, &node->index->ihdr, key, key_len, ctx,
|
||||
diff);
|
||||
if (!e) {
|
||||
err = -EINVAL;
|
||||
put_indx_node(node);
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fnd_push(fnd, node, e);
|
||||
}
|
||||
|
||||
out:
|
||||
return err;
|
||||
*entry = e;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
|
||||
@ -1994,7 +1987,7 @@ static int indx_free_children(struct ntfs_index *indx, struct ntfs_inode *ni,
|
||||
const struct NTFS_DE *e, bool trim)
|
||||
{
|
||||
int err;
|
||||
struct indx_node *n;
|
||||
struct indx_node *n = NULL;
|
||||
struct INDEX_HDR *hdr;
|
||||
CLST vbn = de_get_vbn(e);
|
||||
size_t i;
|
||||
|
@ -430,6 +430,7 @@ end_enum:
|
||||
} else if (fname && fname->home.low == cpu_to_le32(MFT_REC_EXTEND) &&
|
||||
fname->home.seq == cpu_to_le16(MFT_REC_EXTEND)) {
|
||||
/* Records in $Extend are not a files or general directories. */
|
||||
inode->i_op = &ntfs_file_inode_operations;
|
||||
} else {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
|
@ -445,12 +445,11 @@ struct ATTRIB *mi_insert_attr(struct mft_inode *mi, enum ATTR_TYPE type,
|
||||
attr = NULL;
|
||||
while ((attr = mi_enum_attr(mi, attr))) {
|
||||
diff = compare_attr(attr, type, name, name_len, upcase);
|
||||
if (diff > 0)
|
||||
break;
|
||||
|
||||
if (diff < 0)
|
||||
continue;
|
||||
|
||||
if (!is_attr_indexed(attr))
|
||||
if (!diff && !is_attr_indexed(attr))
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <linux/fs_context.h>
|
||||
#include <linux/fs_parser.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/minmax.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/nls.h>
|
||||
#include <linux/seq_file.h>
|
||||
@ -390,7 +391,7 @@ static int ntfs_fs_reconfigure(struct fs_context *fc)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memcpy(sbi->options, new_opts, sizeof(*new_opts));
|
||||
swap(sbi->options, fc->fs_private);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -900,6 +901,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
|
||||
ref.high = 0;
|
||||
|
||||
sbi->sb = sb;
|
||||
sbi->options = fc->fs_private;
|
||||
fc->fs_private = NULL;
|
||||
sb->s_flags |= SB_NODIRATIME;
|
||||
sb->s_magic = 0x7366746e; // "ntfs"
|
||||
sb->s_op = &ntfs_sops;
|
||||
@ -1262,8 +1265,6 @@ load_root:
|
||||
goto put_inode_out;
|
||||
}
|
||||
|
||||
fc->fs_private = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
put_inode_out:
|
||||
@ -1416,7 +1417,6 @@ static int ntfs_init_fs_context(struct fs_context *fc)
|
||||
mutex_init(&sbi->compress.mtx_lzx);
|
||||
#endif
|
||||
|
||||
sbi->options = opts;
|
||||
fc->s_fs_info = sbi;
|
||||
ok:
|
||||
fc->fs_private = opts;
|
||||
|
@ -706,13 +706,13 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
|
||||
inode->i_default_acl = NULL;
|
||||
}
|
||||
|
||||
if (!acl)
|
||||
inode->i_acl = NULL;
|
||||
else {
|
||||
if (acl) {
|
||||
if (!err)
|
||||
err = ntfs_set_acl_ex(mnt_userns, inode, acl,
|
||||
ACL_TYPE_ACCESS, true);
|
||||
posix_acl_release(acl);
|
||||
} else {
|
||||
inode->i_acl = NULL;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
Loading…
x
Reference in New Issue
Block a user